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

View File

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

View File

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

View File

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

View File

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