language: php

php:
  - 5.5
  - 5.6
  - 7.0

matrix:
  include:
    - php: 5.5
      env:
        - COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
        - COVERAGE="--coverage-clover=coverage.xml"

install:
  - if [ ! -f "$(php-config --extension-dir)/amqp.so" ] && [ "${TRAVIS_PHP_VERSION}" = "7.0" ]; then printf "\n" | pecl install amqp-1.7.0alpha2; fi;
  - echo "extension = amqp.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
  - travis_retry wget http://get.sensiolabs.org/php-cs-fixer.phar -O php-cs-fixer.phar

before_script:
  - travis_retry composer self-update
  - travis_retry composer update ${COMPOSER_FLAGS} --no-interaction

script:
  - vendor/bin/phpunit ${COVERAGE}
  - php php-cs-fixer.phar fix src/ --level=psr2 --dry-run

after_script:
  - if [[ "${COVERAGE}" != "" ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
  - if [[ "${COVERAGE}" != "" ]]; then php ocular.phar code-coverage:upload --format=php-clover coverage.xml; fi

language: php

php:
  - 5.5
  - 5.6
  - 7.0

sudo: false

matrix:
  include:
    - php: 5.5
      env:
        - COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
        - COVERAGE="--coverage-clover=coverage.xml"

install:
  - if [ "${COVERAGE}" = "" ]; then phpenv config-rm xdebug.ini; fi;
  - if [ ! -f "$(php-config --extension-dir)/amqp.so" ] && [ "${TRAVIS_PHP_VERSION}" = "7.0" ]; then printf "\n" | pecl install amqp-1.7.0alpha2; fi;
  - echo "extension = amqp.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
  - travis_retry wget http://get.sensiolabs.org/php-cs-fixer.phar -O php-cs-fixer.phar

before_script:
  - travis_retry composer self-update
  - travis_retry composer update ${COMPOSER_FLAGS} --no-interaction

script:
  - vendor/bin/phpunit ${COVERAGE}
  - php php-cs-fixer.phar fix src/ --level=psr2 --dry-run

after_script:
  - if [ "${COVERAGE}" != "" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
  - if [ "${COVERAGE}" != "" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.xml; fi

cache:
  directories:
    - $HOME/.composer/cache

Remove xdebug when not running coverage and cache composer
[Travis] Remove xdebug when not running coverage and cache composer
