language: php
sudo: false

php:
  - 5.3
  - 5.4
  - 5.5
  - 5.6
  - 7.0
  - nightly
  - hhvm

os:
  - linux

services:
  - memcached # will start memcached service
  - redis-server

env:
  #require PHP 5.3
  - DOCTRINE_VERSION=v1.1 ZEND_VERSION=2.1.* DESARROLLA_VERSION=1.4.0 ZETA_VERSION=1.6
  - DOCTRINE_VERSION=v1.2.0 ZEND_VERSION=2.2.* DESARROLLA_VERSION=1.5.0 ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=v1.3.0 ZEND_VERSION=2.3.* DESARROLLA_VERSION=1.6.0 ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=1.3.1 ZEND_VERSION=2.4.0 DESARROLLA_VERSION=1.7.0 ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=1.4.0 ZEND_VERSION=2.4.1 DESARROLLA_VERSION=1.7.1 ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=1.4.1 ZEND_VERSION=2.4.2 DESARROLLA_VERSION=1.8.0 ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=1.5.0 ZEND_VERSION=2.4.3 DESARROLLA_VERSION=1.8.0 ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=1.5.1 ZEND_VERSION=2.4.4 DESARROLLA_VERSION=1.8.0 ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=1.5.2 ZEND_VERSION=2.4.5 DESARROLLA_VERSION=1.8.0 ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=1.5.3 ZEND_VERSION=2.4.6 DESARROLLA_VERSION=1.8.0 ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=1.5.4 ZEND_VERSION=2.4.7 DESARROLLA_VERSION=1.8.0 ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=1.5.4 ZEND_VERSION=2.4.8 DESARROLLA_VERSION=1.8.0 ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=1.5.4 ZEND_VERSION=2.4.9 DESARROLLA_VERSION=1.8.0 ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=1.5.4 ZEND_VERSION=2.5.0 DESARROLLA_VERSION=1.8.0 ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=1.5.4 ZEND_VERSION=2.5.1 DESARROLLA_VERSION=1.8.1 ZETA_VERSION=dev-master
  #require PHP 5.4
  - DOCTRINE_VERSION=1.5.4 ZEND_VERSION=2.5.1 DESARROLLA_VERSION=2.0.0 ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=1.5.4 ZEND_VERSION=2.5.1 DESARROLLA_VERSION=2.1.0 ZETA_VERSION=dev-master
  #require PHP 5.5
  - DOCTRINE_VERSION=1.6.0 ZEND_VERSION=2.5.2 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=dev-master ZEND_VERSION=2.5.3 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=dev-master ZEND_VERSION=2.6.0 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=dev-master ZEND_VERSION=2.6.1 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=dev-master ZEND_VERSION=2.7.0 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=dev-master ZEND_VERSION=2.7.1 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
  - DOCTRINE_VERSION=dev-master ZEND_VERSION=dev-master DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master

matrix:
  allow_failures:
  # may fail due a segmentation fault
    - php: nightly
  # the tests may require > 4.8GB ram on hhvm, this exeeds the memory limit on the travis-ci boxes so we allow to fail these builds
    - php: hhvm
  exclude:
    # require PHP 5.4
    - env: DOCTRINE_VERSION=1.5.4 ZEND_VERSION=2.5.1 DESARROLLA_VERSION=2.0.0 ZETA_VERSION=dev-master
      php: 5.3
    - env: DOCTRINE_VERSION=1.5.4 ZEND_VERSION=2.5.1 DESARROLLA_VERSION=2.1.0 ZETA_VERSION=dev-master
      php: 5.3
    # require PHP 5.5
    - env: DOCTRINE_VERSION=1.6.0 ZEND_VERSION=2.5.2 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
      php: 5.3
    - env: DOCTRINE_VERSION=1.6.0 ZEND_VERSION=2.5.2 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
      php: 5.4
    - env: DOCTRINE_VERSION=dev-master ZEND_VERSION=2.5.3 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
      php: 5.3
    - env: DOCTRINE_VERSION=dev-master ZEND_VERSION=2.5.3 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
      php: 5.4
    - env: DOCTRINE_VERSION=dev-master ZEND_VERSION=2.6.0 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
      php: 5.3
    - env: DOCTRINE_VERSION=dev-master ZEND_VERSION=2.6.0 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
      php: 5.4
    - env: DOCTRINE_VERSION=dev-master ZEND_VERSION=2.6.1 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
      php: 5.3
    - env: DOCTRINE_VERSION=dev-master ZEND_VERSION=2.6.1 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
      php: 5.4
    - env: DOCTRINE_VERSION=dev-master ZEND_VERSION=2.7.0 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
      php: 5.3
    - env: DOCTRINE_VERSION=dev-master ZEND_VERSION=2.7.0 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
      php: 5.4
    - env: DOCTRINE_VERSION=dev-master ZEND_VERSION=2.7.1 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
      php: 5.3
    - env: DOCTRINE_VERSION=dev-master ZEND_VERSION=2.7.1 DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
      php: 5.4
    - env: DOCTRINE_VERSION=dev-master ZEND_VERSION=dev-master DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
      php: 5.3
    - env: DOCTRINE_VERSION=dev-master ZEND_VERSION=dev-master DESARROLLA_VERSION=dev-master ZETA_VERSION=dev-master
      php: 5.4

before_script:
#   Set Configuration
  - if [ "`phpenv version-name`" != "hhvm" ]; then echo 'opcache.enable=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
  - if [ "`phpenv version-name`" != "hhvm" ]; then echo 'opcache.enable_cli=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
  - if [ "`phpenv version-name`" == "hhvm" ]; then echo 'opcache.enable=1' >> /etc/hhvm/php.ini; fi
  - if [ "`phpenv version-name`" == "hhvm" ]; then echo 'opcache.enable_cli=1' >> /etc/hhvm/php.ini; fi
  - if [ "`phpenv version-name`" != "hhvm" ]; then echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
  - if [ "`phpenv version-name`" == "5.3" ] || [ "`phpenv version-name`" == "5.4" ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
  - if [ "`phpenv version-name`" != "hhvm" ]; then echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
  - if [ "`phpenv version-name`" != "hhvm" ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
  - if [ "`phpenv version-name`" != "hhvm" ]; then echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi

#   Update composer
  - composer self-update

#   Install dependencies
  - composer require --no-update phpunit/phpunit:*
  - composer require --no-update mikey179/vfsStream:*
  - composer require --no-update zetacomponents/cache:${ZETA_VERSION}
  - composer require --no-update doctrine/cache:${DOCTRINE_VERSION}
  - composer require --no-update zendframework/zend-cache:${ZEND_VERSION}
  - composer require --no-update desarrolla2/cache:${DESARROLLA_VERSION}
  - composer require --no-update squizlabs/php_codesniffer:*
  - composer require --no-update fabpot/php-cs-fixer:*
  - composer update --no-dev -o --prefer-source

script:
# xdebug is not installed on HHVM and PHP 7, so we are skipping the creation of code coverage data there
  - if [ "`phpenv version-name`" == "5.3" ] || [ "`phpenv version-name`" == "5.4" ] || [ "`phpenv version-name`" == "5.5" ] || [ "`phpenv version-name`" == "5.6" ]; then vendor/bin/phpunit --colors --verbose --coverage-clover=coverage.clover; fi
  - if [ "`phpenv version-name`" != "5.3" ] && [ "`phpenv version-name`" != "5.4" ] && [ "`phpenv version-name`" != "5.5" ] && [ "`phpenv version-name`" != "5.6" ]; then vendor/bin/phpunit --colors --verbose; fi
  - vendor/bin/phpcs --standard=psr2 -np src tests
  - vendor/bin/php-cs-fixer fix --dry-run -vv

after_success:
# xdebug is not installed on HHVM and PHP 7, so we have no code coverage data to send
  - if [ "`phpenv version-name`" == "5.3" ] || [ "`phpenv version-name`" == "5.4" ] || [ "`phpenv version-name`" == "5.5" ] || [ "`phpenv version-name`" == "5.6" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
  - if [ "`phpenv version-name`" == "5.3" ] || [ "`phpenv version-name`" == "5.4" ] || [ "`phpenv version-name`" == "5.5" ] || [ "`phpenv version-name`" == "5.6" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi

notifications:
  email: false
