language: php

php:
    - 5.5
    - 5.6
    - 7.0

before_script:
    - echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
    - composer self-update
    - composer install
    - composer require "doctrine/mongodb-odm"

script:
    - cd $TRAVIS_BUILD_DIR/test
    - phpunit --configuration phpunit.xml.ci
    - cd $TRAVIS_BUILD_DIR
    - ./vendor/squizlabs/php_codesniffer/scripts/phpcs --standard=PSR2 -s -p --extensions=php ./src ./test

after_script:
    - php vendor/bin/coveralls

language: php

matrix:
  fast_finish: true
  include:
    - php: 5.5
      env:
        - MONGO_EXTENSION_SUPPORTED=true
    - php: 5.6
      env:
        - MONGO_EXTENSION_SUPPORTED=true
    - php: 7.0
      env:
        - MONGO_EXTENSION_SUPPORTED=false

before_script:
    - if [[ $MONGO_EXTENSION_SUPPORTED == 'true' ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini ; fi
    - composer self-update
    - if [[ $MONGO_EXTENSION_SUPPORTED == true ]]; then composer install ; fi
    - if [[ $MONGO_EXTENSION_SUPPORTED == false ]]; then composer install --ignore-platform-reqs ; fi

script:
    - cd $TRAVIS_BUILD_DIR/test
    - phpunit --configuration phpunit.xml.ci
    - cd $TRAVIS_BUILD_DIR
    - ./vendor/squizlabs/php_codesniffer/scripts/phpcs --standard=PSR2 -s -p --extensions=php ./src ./test

after_script:
    - php vendor/bin/coveralls

Use --ignore-platform-reqs for the PHP 7 tests
Use --ignore-platform-reqs for the PHP 7 tests

The code works, but the Mongo extension is not supported in PHP 7 yet,
which prevents the doctrine/mongo* packages from being installed.

This is all being done to support installation in PHP 7 for folks using
this library for the ORM query builder mock, which doesn't have this
issue.
