From 5e0d1268344d8fdc4d35d189893cb004b01fad91 Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Wed, 23 Mar 2016 11:21:21 +0100 Subject: [PATCH] Add syntax checking and PHPUnit to Travis --- .php_cs | 15 +++++++++++++++ .travis.yml | 27 +++++++++++++++++++++++++++ composer.json | 1 + 3 files changed, 43 insertions(+) create mode 100644 .php_cs create mode 100644 .travis.yml diff --git a/.php_cs b/.php_cs new file mode 100644 index 0000000..f084e77 --- /dev/null +++ b/.php_cs @@ -0,0 +1,15 @@ +level(Symfony\CS\FixerInterface::NONE_LEVEL) + ->fixers([ + "psr2", + "-braces", + "-psr0", + ]) + ->finder( + Symfony\CS\Finder\DefaultFinder::create() + ->in(__DIR__ . "/bin") + ->in(__DIR__ . "/src") + ->in(__DIR__ . "/test") + ); diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..976d11b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,27 @@ +language: php + +php: + - 5.5 + - 5.6 + - 7.0 + - nightly + +cache: + directories: + - vendor + +install: + - phpenv config-rm xdebug.ini + - composer self-update + - if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.5" ]]; then composer require --dev --no-update phpunit/phpunit ^4; fi + - composer require satooshi/php-coveralls dev-master --dev --no-update + - composer update --ignore-platform-reqs + - composer show --installed + +script: + - find -name "*.php" -not -path "./vendor/*" -print0 | xargs -n 1 -0 php -l + - $(php -r 'if (PHP_MAJOR_VERSION >= 7) echo "phpdbg -qrr"; else echo "php";') vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml + - php vendor/bin/php-cs-fixer --diff --dry-run -v fix + +after_script: + - php vendor/bin/coveralls -v diff --git a/composer.json b/composer.json index 09fbaf9..3af8cac 100644 --- a/composer.json +++ b/composer.json @@ -42,6 +42,7 @@ }, "require-dev": { "phpunit/phpunit": "^5", + "fabpot/php-cs-fixer": "^1.9", "macfja/phar-builder": "^0.2.3" }, "extra": {