8000 bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check to also c… · nicolas-grekas/symfony@cfb090d · GitHub
[go: up one dir, main page]

Skip to content

Commit cfb090d

Browse files
committed
bug symfony#22925 [PhpUnitBridge] Adjust PHPUnit class_alias check to also check for namespaced class (GawainLynch)
This PR was merged into the 3.3 branch. Discussion ---------- [PhpUnitBridge] Adjust PHPUnit class_alias check to also check for namespaced class | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Some projects, e.g. [Codeception](https://github.com/Codeception/Codeception/blob/2.3.2/shim.php#L47), also alias pre-PHPUnit namespaces leading to a collision and exceptions such as: ``` [PHPUnit\Framework\Exception (2)] Cannot declare class Symfony\Bridge\PhpUnit\SymfonyTestsListener, because the name is already in use ``` This just add a check for the namespaced class, and exits if either aliased or exists. Commits ------- 7ba3afd Adjust PHPUnit class_alias check to also check for namespaced class
2 parents 4e8f403 + 7ba3afd commit cfb090d

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use PHPUnit\Framework\TestSuite;
1717
use PHPUnit\Framework\Warning;
1818

19-
if (class_exists('PHPUnit_Framework_BaseTestListener')) {
19+
if (class_exists('PHPUnit_Framework_BaseTestListener') && !class_exists('PHPUnit\Framework\BaseTestListener')) {
2020
class_alias('Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener', 'Symfony\Bridge\PhpUnit\SymfonyTestsListener');
2121

2222
return;

src/Symfony/Bridge/PhpUnit/TextUI/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use PHPUnit\TextUI\Command as BaseCommand;
1515

16-
if (class_exists('PHPUnit_TextUI_Command')) {
16+
if (class_exists('PHPUnit_TextUI_Command') && !class_exists('PHPUnit\TextUI\Command')) {
1717
class_alias('Symfony\Bridge\PhpUnit\Legacy\Command', 'Symfony\Bridge\PhpUnit\TextUI\Command');
1818

1919
return;

src/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use PHPUnit\TextUI\TestRunner as BaseRunner;
1515
use Symfony\Bridge\PhpUnit\SymfonyTestsListener;
1616

17-
if (class_exists('PHPUnit_TextUI_Command')) {
17+
if (class_exists('PHPUnit_TextUI_Command') && !class_exists('PHPUnit\TextUI\Command')) {
1818
class_alias('Symfony\Bridge\PhpUnit\Legacy\TestRunner', 'Symfony\Bridge\PhpUnit\TextUI\TestRunner');
1919

2020
return;

0 commit comments

Comments
 (0)
0