See #294. Add missing argument to PHP-CS-Fixer beautifier

And enable tests for Travis CI
This commit is contained in:
Glavin Wiechert 2015-05-03 12:50:45 -03:00
parent 141bca7aba
commit cc9b8e8ff2
8 changed files with 23 additions and 15 deletions

View File

@ -40,11 +40,11 @@ before_install:
# Java, C, C++, C#, Objective-C, D, Pawn, Vala
- brew install uncrustify
# PHP
# - brew tap homebrew/homebrew-php
# - brew gist-logs php56
# - brew install php56
# - echo -e "\n[Phar]\nphar.readonly = Off\n" >> /usr/local/etc/php/5.6/php.ini
# - brew gist-logs php-cs-fixer
# - brew install php-cs-fixer
- brew tap homebrew/homebrew-php
- brew install php56
- brew gist-logs php56
- echo -e "\n[Phar]\nphar.readonly = Off\n" >> /usr/local/etc/php/5.6/php.ini
- brew install php-cs-fixer
- brew gist-logs php-cs-fixer
# CoffeeScript
- npm install coffee-formatter

View File

@ -1,13 +1,18 @@
<?php
class Date {
class Date
{
const FORMAT_FULL = 'full';
const FORMAT_LONG = 'long';
const FORMAT_MEDIUM = 'medium';
const FORMAT_SHORT = 'short';
public static function formatDate($time, $format) {
public static function formatDate($time, $format)
{
if (!$time || $time == null) {
return '';
}
return $time;
}
}

View File

@ -134,8 +134,9 @@ describe "BeautifyLanguages", ->
beautifyCompleted = false
completionFun = (text) ->
if text instanceof Error
return beautifyCompleted = text # text == Error
expect(text instanceof Error).not.toEqual(true, text)
# if text instanceof Error
# return beautifyCompleted = text # text == Error
expect(typeof text).toEqual "string"
# Check for beautification errors
if text isnt expectedContents

View File

@ -150,7 +150,7 @@ module.exports = class Beautifier
options = {
env: env
}
# console.log('spawn', exe, args)
console.log('spawn', exe, args)
cmd = spawn(exe, args, options)
# add a 'data' event listener for the spawn instance
cmd.stdout.on('data', (data) -> stdout += data )

View File

@ -7,17 +7,19 @@ Beautifier = require('./beautifier')
module.exports = class PHPCSFixer extends Beautifier
name: "PHP-CS-Fixer"
options: {
PHP: true
}
beautify: (text, language, options) ->
console.log('php-cs-fixer', options)
@run("php-cs-fixer", [
"--level=#{options.level}" if options.level?
"--fixers=#{options.fixers}" if options.fixers?
"fix"
"--level=#{options.level}" if options.level
"--fixers=#{options.fixers}" if options.fixers
tempFile = @tempFile("temp", text)
])
], {ignoreReturnCode: true})
.then(=>
@readFile(tempFile)
)