diff --git a/.travis.yml b/.travis.yml index 20a57ed..e888e79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,13 +15,15 @@ matrix: env: PHPUNIT_TEST=1 - php: 7.3 env: PHPUNIT_TEST=1 PHPCS_TEST=1 + - php: 7.4 + env: PHPUNIT_TEST=1 before_script: - export PATH=~/.composer/vendor/bin:$PATH - composer validate - - composer install --dev --prefer-dist + - composer install --prefer-dist - composer require --prefer-dist --no-update silverstripe/recipe-core:^4 - composer update - if [[ $PHPCS_TEST ]]; then composer global require squizlabs/php_codesniffer:^3 --prefer-dist --no-interaction --no-progress --no-suggest -o; fi diff --git a/composer.json b/composer.json index cc8a65b..fe4b924 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ ], "require": { "php": ">=5.6", - "phpunit/phpunit": "^5.7", + "sminnee/phpunit": "^5.7", "behat/behat": "^3.2", "behat/mink": "^1.7", "behat/mink-extension": "^2.1", diff --git a/src/Extension.php b/src/Extension.php index a864af8..24dffb1 100644 --- a/src/Extension.php +++ b/src/Extension.php @@ -15,6 +15,7 @@ use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Behat\Testwork\ServiceContainer\ExtensionManager; use Behat\Testwork\ServiceContainer\Extension as ExtensionInterface; +use RuntimeException; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; @@ -52,8 +53,26 @@ class Extension implements ExtensionInterface public function initialize(ExtensionManager $extensionManager) { - // PHPUnit - require_once BASE_PATH . '/vendor/phpunit/phpunit/src/Framework/Assert/Functions.php'; + // Find PHPUnit assertion implementations + + $found = false; + + $options = [ + BASE_PATH . '/vendor/sminnee/phpunit/src/Framework/Assert/Functions.php', + BASE_PATH . '/vendor/phpunit/phpunit/src/Framework/Assert/Functions.php' + ]; + + foreach ($options as $file) { + if (file_exists($file)) { + require_once $file; + $found = true; + break; + } + } + + if (!$found) { + throw new RuntimeException('Could not find PHPUnit installation'); + } } public function load(ContainerBuilder $container, array $config)