language: php

sudo: false

cache:
    directories:
        - $HOME/.composer/cache/files
        - $HOME/symfony-bridge/.phpunit

php:
    - 5.4
    - 5.5
    - 5.6
    - 7.0
    - 7.1
    - nightly

env:
    global:
        - SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"

matrix:
    include:
        - php: 5.6
          env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable' SYMFONY_DEPRECATIONS_HELPER=weak
        - php: 7.1
          env: DEPENDENCIES=dev
        - php: hhvm
          dist: trusty
        - php: 5.3
          dist: precise

before_install:
    - if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
    # force the PHPUnit version for PHP 7.2, until https://github.com/symfony/symfony/issues/23943 is resolved
    - if [ "$TRAVIS_PHP_VERSION" = "nightly" ]; then export SYMFONY_PHPUNIT_VERSION="6.3"; fi;

install:
    - composer update $COMPOSER_FLAGS
    - ./vendor/bin/simple-phpunit install

script:
    - php ./vendor/bin/simple-phpunit

language: php

sudo: false

cache:
    directories:
        - $HOME/.composer/cache/files
        - $HOME/symfony-bridge/.phpunit

php:
    - 5.4
    - 5.5
    - 5.6
    - 7.0
    - 7.1
    - nightly

env:
    global:
        - SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"

matrix:
    include:
        - php: 5.6
          env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable' SYMFONY_DEPRECATIONS_HELPER=weak
        - php: 7.1
          env: DEPENDENCIES=dev
        - php: hhvm
          dist: trusty
        - php: 5.3
          dist: precise

before_install:
    - if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
    # force the PHPUnit version for PHP 7.2, until https://github.com/symfony/symfony/issues/23943 is resolved
    - if [ "$TRAVIS_PHP_VERSION" = "nightly" ]; then export SYMFONY_PHPUNIT_VERSION="6.3"; fi;

install:
    - composer update $COMPOSER_FLAGS
    - ./vendor/bin/simple-phpunit install

script:
    - composer validate --strict --no-check-lock
    - php ./vendor/bin/simple-phpunit

Add validation of the composer.json on Travis
Add validation of the composer.json on Travis

This prevents PRs breaking the validity of the composer.json, which would
then be rejected by Packagist.
The lock file is not validated, as it is not committed in the repo.
