Skip to content

Add composer scripts for php-cs-fixer #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ matrix:
before_install:
- if [[ "$WITH_COVERAGE" != "true" && "$TRAVIS_PHP_VERSION" != "hhvm" && "$TRAVIS_PHP_VERSION" != "nightly" && "$TRAVIS_PHP_VERSION" != "7.1" ]]; then phpenv config-rm xdebug.ini; fi
- composer selfupdate
- if [[ "$TRAVIS_PHP_VERSION" = "hhvm" || "$TRAVIS_PHP_VERSION" = "nightly" ]]; then sed -i '/^.*friendsofphp\/php-cs-fixer.*$/d' composer.json; fi

install:
- travis_retry composer install --no-interaction --prefer-dist

script:
- if [[ "$WITH_COVERAGE" == "true" ]]; then ./vendor/bin/phpunit --coverage-text; else composer test; fi
- if [[ "$WITH_PHPCSFIXER" == "true" ]]; then composer require friendsofphp/php-cs-fixer:^2.1 && mkdir -p $HOME/.phpcsfixer && vendor/bin/php-cs-fixer fix --cache-file "$HOME/.phpcsfixer/.php_cs.cache" --dry-run --diff --verbose; fi
- if [[ "$WITH_PHPCSFIXER" == "true" ]]; then mkdir -p $HOME/.phpcsfixer && vendor/bin/php-cs-fixer fix --cache-file "$HOME/.phpcsfixer/.php_cs.cache" --dry-run --diff --verbose; fi
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ will modify your original data.
## Running the tests

```bash
composer test
composer testOnly TestClass
composer testOnly TestClass::testMethod
composer test # run all unit tests
composer testOnly TestClass # run specific unit test class
composer testOnly TestClass::testMethod # run specific unit test method
composer style-check # check code style for errors
composer style-fix # automatically fix code style errors
```
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"require-dev": {
"json-schema/JSON-Schema-Test-Suite": "1.2.0",
"phpunit/phpunit": "^4.8.22",
"friendsofphp/php-cs-fixer": "^2.1",
"phpdocumentor/phpdocumentor": "~2"
},
"autoload": {
Expand All @@ -58,6 +59,8 @@
"scripts": {
"test" : "vendor/bin/phpunit",
"testOnly" : "vendor/bin/phpunit --colors --filter",
"coverage" : "vendor/bin/phpunit --coverage-text"
"coverage" : "vendor/bin/phpunit --coverage-text",
"style-check" : "vendor/bin/php-cs-fixer fix --dry-run --verbose --diff",
"style-fix" : "vendor/bin/php-cs-fixer fix --verbose"
}
}