language: php

matrix:
  include:
    - php: 7.3
      env:
        - DEPS=lowest
    - php: 7.3
      env:
        - DEPS=latest
    - php: 7.4
      env:
        - DEPS=lowest
    - php: 7.4
      env:
        - DEPS=latest
    - php: nightly
      env:
        - DEPS=lowest
        - COMPOSER_FLAGS="--ignore-platform-reqs"
    - php: nightly
      env:
        - DEPS=latest
        - COMPOSER_FLAGS="--ignore-platform-reqs"

before_install:
  - |
    composer self-update --2
    if [[ $TRAVIS_PHP_VERSION == "nightly" ]]; then
      composer require --dev --no-update "phpunit/phpunit:^9.3.2"
    fi

install:
  - if [[ $DEPS == 'latest' ]]; then travis_retry composer update --no-interaction $COMPOSER_FLAGS ; fi
  - if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable --no-interaction $COMPOSER_FLAGS ; fi

script:
- |
    if [[ $TRAVIS_PHP_VERSION == 'nightly' ]]; then
      ./vendor/bin/phpunit --coverage-text --coverage-clover="build/logs/clover.xml" --testsuite="Mockery Test Suite PHP8";
    else
      ./vendor/bin/phpunit --coverage-text --coverage-clover="build/logs/clover.xml" --testsuite="Mockery Test Suite PHP7";
    fi

after_success:
  - composer require satooshi/php-coveralls
  - vendor/bin/coveralls -v
  - wget https://scrutinizer-ci.com/ocular.phar
  - php ocular.phar code-coverage:upload --format=php-clover "build/logs/clover.xml"
  - make apidocs

notifications:
  email:
    - padraic.brady@gmail.com
    - dave@atstsolutions.co.uk

  irc: irc.freenode.org#mockery
deploy:
  overwrite: true
  provider: pages
  file_glob: true
  file: docs/api/*
  local_dir: docs/api
  skip_cleanup: true
  github_token: $GITHUB_TOKEN
  on:
    branch: master
    php: '7.3'
    condition: $DEPS = latest
