MNT Add support for sminnee/phpunit fork

This commit is contained in:
Serge Latyntcev 2020-10-08 13:03:18 +13:00
parent 8dc02fd0db
commit 892aee9592
3 changed files with 25 additions and 4 deletions

View File

@ -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

View File

@ -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",

View File

@ -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)