sudo: false
language: php

php:
  - 5.5
  - 5.6
  - 7.0

env:
  - DRIVER_VERSION=stable

matrix:
  include:
    - php: 5.6
      env: DRIVER_VERSION=stable LEGACY_DRIVER_VERSION=stable

addons:
  apt:
    sources:
    - mongodb-3.2-precise
    packages:
    - mongodb-org-server

before_script:
  - pecl install -f mongodb-${DRIVER_VERSION}
  - composer install
  - if [ "x$LEGACY_DRIVER_VERSION" != "x" ]; then yes '' | pecl -q install -f mongo-${LEGACY_DRIVER_VERSION}; fi

script:
    - ./vendor/bin/phpunit --coverage-clover=coverage.clover

after_script:
    - wget https://scrutinizer-ci.com/ocular.phar
    - php ocular.phar code-coverage:upload --format=php-clover coverage.clover
