Merge branch '3.3' into 3.4

* 3.3:
  [Bridge/PhpUnit] Fix compat with phpunit 4.8 & bridge <=3.3.13
  Remove function_exists(__phpunit_run_isolated_test) checks
This commit is contained in:
Nicolas Grekas 2017-11-19 22:09:36 +02:00
commit 4baf9688a9
9 changed files with 30 additions and 28 deletions

View File

@ -98,7 +98,7 @@
"ocramius/proxy-manager": "~0.4|~1.0|~2.0",
"predis/predis": "~1.0",
"egulias/email-validator": "~1.2,>=1.2.8|~2.0",
"symfony/phpunit-bridge": "~3.2",
"symfony/phpunit-bridge": "~3.4|~4.0",
"symfony/security-acl": "~2.8|~3.0",
"phpdocumentor/reflection-docblock": "^3.0|^4.0"
},

View File

@ -23,12 +23,19 @@ class Blacklist
public function getBlacklistedDirectories()
{
$root = dirname(__DIR__);
while ($root !== $parent = dirname($root)) {
$root = $parent;
$blacklist = array();
foreach (get_declared_classes() as $class) {
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$v = dirname(dirname($r->getFileName()));
if (file_exists($v.'/composer/installed.json')) {
$blacklist[] = $v;
}
}
}
return array($root);
return $blacklist;
}
public function isBlacklisted($file)
@ -37,5 +44,9 @@ class Blacklist
}
}
class_alias('Symfony\Bridge\PhpUnit\Blacklist', 'PHPUnit\Util\Blacklist');
class_alias('Symfony\Bridge\PhpUnit\Blacklist', 'PHPUnit_Util_Blacklist');
if (class_exists('PHPUnit\Util\Test')) {
class_alias('Symfony\Bridge\PhpUnit\Blacklist', 'PHPUnit\Util\Blacklist');
}
if (class_exists('PHPUnit_Util_Test')) {
class_alias('Symfony\Bridge\PhpUnit\Blacklist', 'PHPUnit_Util_Blacklist');
}

View File

@ -68,7 +68,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) {
passthru("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
}
passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"~3.3.11@dev|~3.4.0-beta2@dev|^4.0.0-beta2@dev\"");
passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"~3.4-beta5@dev|^4.0-beta5@dev\"");
$prevRoot = getenv('COMPOSER_ROOT_VERSION');
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
$exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", array(), $p, getcwd(), null, array('bypass_shell' => true)));

View File

@ -13,7 +13,9 @@ use Doctrine\Common\Annotations\AnnotationRegistry;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
// Replace the native phpunit Blacklist, it's a broken artifact from the past
require_once __DIR__.'/Blacklist.php';
if (!class_exists('Symfony\Bridge\PhpUnit\Blacklist', false)) {
require_once __DIR__.'/Blacklist.php';
}
// Detect if we need to serialize deprecations to a file.
if ($file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {

View File

@ -2,9 +2,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation;
if (!function_exists('__phpunit_run_isolated_test')) {
class Article implements NotExistingInterface
{
public $category;
}
class Article implements NotExistingInterface
{
public $category;
}

View File

@ -2,8 +2,6 @@
namespace Symfony\Component\Config\Tests\Fixtures;
if (!function_exists('__phpunit_run_isolated_test')) {
class BadParent extends MissingParent
{
}
class BadParent extends MissingParent
{
}

View File

@ -1,5 +1,3 @@
<?php
if (!function_exists('__phpunit_run_isolated_test')) {
throw new \Exception('boo');
}
throw new \Exception('boo');

View File

@ -13,8 +13,6 @@ namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use Symfony\Bug\NotExistClass;
if (!function_exists('__phpunit_run_isolated_test')) {
class OptionalServiceClass extends NotExistClass
{
}
class OptionalServiceClass extends NotExistClass
{
}

View File

@ -1,8 +1,5 @@
<?php
if (function_exists('__phpunit_run_isolated_test')) {
return;
}
/** @var $loader \Symfony\Component\Routing\Loader\PhpFileLoader */
/** @var \Symfony\Component\Routing\RouteCollection $collection */
$collection = $loader->import('validpattern.php');