Skip to content

Commit 4baf968

Browse files
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
2 parents eb92d7c + 0187e9b commit 4baf968

File tree

9 files changed

+30
-28
lines changed

9 files changed

+30
-28
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"ocramius/proxy-manager": "~0.4|~1.0|~2.0",
9999
"predis/predis": "~1.0",
100100
"egulias/email-validator": "~1.2,>=1.2.8|~2.0",
101-
"symfony/phpunit-bridge": "~3.2",
101+
"symfony/phpunit-bridge": "~3.4|~4.0",
102102
"symfony/security-acl": "~2.8|~3.0",
103103
"phpdocumentor/reflection-docblock": "^3.0|^4.0"
104104
},

src/Symfony/Bridge/PhpUnit/Blacklist.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,19 @@ class Blacklist
2323

2424
public function getBlacklistedDirectories()
2525
{
26-
$root = dirname(__DIR__);
27-
while ($root !== $parent = dirname($root)) {
28-
$root = $parent;
26+
$blacklist = array();
27+
28+
foreach (get_declared_classes() as $class) {
29+
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
30+
$r = new \ReflectionClass($class);
31+
$v = dirname(dirname($r->getFileName()));
32+
if (file_exists($v.'/composer/installed.json')) {
33+
$blacklist[] = $v;
34+
}
35+
}
2936
}
3037

31-
return array($root);
38+
return $blacklist;
3239
}
3340

3441
public function isBlacklisted($file)
@@ -37,5 +44,9 @@ public function isBlacklisted($file)
3744
}
3845
}
3946

40-
class_alias('Symfony\Bridge\PhpUnit\Blacklist', 'PHPUnit\Util\Blacklist');
41-
class_alias('Symfony\Bridge\PhpUnit\Blacklist', 'PHPUnit_Util_Blacklist');
47+
if (class_exists('PHPUnit\Util\Test')) {
48+
class_alias('Symfony\Bridge\PhpUnit\Blacklist', 'PHPUnit\Util\Blacklist');
49+
}
50+
if (class_exists('PHPUnit_Util_Test')) {
51+
class_alias('Symfony\Bridge\PhpUnit\Blacklist', 'PHPUnit_Util_Blacklist');
52+
}

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
6868
if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) {
6969
passthru("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
7070
}
71-
passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"~3.3.11@dev|~3.4.0-beta2@dev|^4.0.0-beta2@dev\"");
71+
passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"~3.4-beta5@dev|^4.0-beta5@dev\"");
7272
$prevRoot = getenv('COMPOSER_ROOT_VERSION');
7373
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
7474
$exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", array(), $p, getcwd(), null, array('bypass_shell' => true)));

src/Symfony/Bridge/PhpUnit/bootstrap.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
1414

1515
// Replace the native phpunit Blacklist, it's a broken artifact from the past
16-
require_once __DIR__.'/Blacklist.php';
16+
if (!class_exists('Symfony\Bridge\PhpUnit\Blacklist', false)) {
17+
require_once __DIR__.'/Blacklist.php';
18+
}
1719

1820
// Detect if we need to serialize deprecations to a file.
1921
if ($file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Article.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation;
44

5-
if (!function_exists('__phpunit_run_isolated_test')) {
6-
class Article implements NotExistingInterface
7-
{
8-
public $category;
9-
}
5+
class Article implements NotExistingInterface
6+
{
7+
public $category;
108
}

src/Symfony/Component/Config/Tests/Fixtures/BadParent.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Symfony\Component\Config\Tests\Fixtures;
44

5-
if (!function_exists('__phpunit_run_isolated_test')) {
6-
class BadParent extends MissingParent
7-
{
8-
}
5+
class BadParent extends MissingParent
6+
{
97
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
<?php
22

3-
if (!function_exists('__phpunit_run_isolated_test')) {
4-
throw new \Exception('boo');
5-
}
3+
throw new \Exception('boo');

src/Symfony/Component/DependencyInjection/Tests/Compiler/OptionalServiceClass.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
use Symfony\Bug\NotExistClass;
1515

16-
if (!function_exists('__phpunit_run_isolated_test')) {
17-
class OptionalServiceClass extends NotExistClass
18-
{
19-
}
16+
class OptionalServiceClass extends NotExistClass
17+
{
2018
}

src/Symfony/Component/Routing/Tests/Fixtures/validresource.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?php
22

3-
if (function_exists('__phpunit_run_isolated_test')) {
4-
return;
5-
}
63
/** @var $loader \Symfony\Component\Routing\Loader\PhpFileLoader */
74
/** @var \Symfony\Component\Routing\RouteCollection $collection */
85
$collection = $loader->import('validpattern.php');

0 commit comments

Comments
 (0)