diff --git a/.travis.yml b/.travis.yml index 5c746a4d..80f141b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,26 +3,35 @@ sudo: false language: php install: - - if [[ $TRAVIS_PHP_VERSION == "hhvm" ]]; then - composer global require squizlabs/PHP_CodeSniffer; - else - pear channel-update pear.php.net; - pear install PHP_CodeSniffer; - fi + - composer global require dealerdirect/phpcodesniffer-composer-installer; + - composer global require phpcompatibility/php-compatibility; + # Use PHPUnit 6 for unit tests (stable), requires PHP 7 - if [[ $TRAVIS_PHP_VERSION == "7.0" ]]; then composer global require phpunit/phpunit ^6; fi + # Use latest PHPUnit on nightly to detect breaking changes + - if [[ $TRAVIS_PHP_VERSION == "nightly" ]]; then + composer global require phpunit/phpunit; + fi script: - phpenv rehash - - if [[ $TRAVIS_PHP_VERSION == "hhvm" ]]; then - /home/travis/.composer/vendor/bin/phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p; - else - phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p; + # Run PHP_CodeSniffer on all versions + - ~/.composer/vendor/bin/phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p; + # Check PHP compatibility for the lowest supported version + - if [[ $TRAVIS_PHP_VERSION == "5.6" ]]; then + ~/.composer/vendor/bin/phpcs . --standard=phpcompatibility.xml --warning-severity=0 --extensions=php -p; fi + # Run unit tests (stable) - if [[ $TRAVIS_PHP_VERSION == "7.0" ]]; then phpunit --configuration=phpunit.xml --include-path=lib/; fi + # Run unit tests (latest/nightly) + # Check PHP compatibility for all versions, starting at the lowest supported version in order to detect breaking changes + - if [[ $TRAVIS_PHP_VERSION == "nightly" ]]; then + phpunit --configuration=phpunit.xml --include-path=lib/; + ~/.composer/vendor/bin/phpcs . --standard=PHPCompatibility --warning-severity=0 --extensions=php -p --runtime-set testVersion 5.6-; + fi matrix: fast_finish: true @@ -30,9 +39,7 @@ matrix: include: - php: 5.6 - php: 7.0 - - php: hhvm - php: nightly allow_failures: - - php: hhvm - php: nightly diff --git a/phpcompatibility.xml b/phpcompatibility.xml new file mode 100644 index 00000000..f232523f --- /dev/null +++ b/phpcompatibility.xml @@ -0,0 +1,47 @@ + + + Defines rules for PHPCompatibility + ./static + ./vendor + + + + + + + + + + + +