8000 bug #38336 [PhpUnitBridge] Fixed class_alias() for PHPUnit\Framework\… · symfony/symfony@72ff401 · GitHub
[go: up one dir, main page]

Skip to content

Commit 72ff401

Browse files
committed
bug #38336 [PhpUnitBridge] Fixed class_alias() for PHPUnit\Framework\Error\Error (stevegrunwell)
This PR was merged into the 4.4 branch. Discussion ---------- [PhpUnitBridge] Fixed class_alias() for PHPUnit\Framework\Error\Error | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | n/a PHPUnit 6.x removed the PHPUnit_Framework_* classes in favor of PHP namespaces, but one error class did not map the same as the others: `PHPUnit_Framework_Error`. Instead of mapping to `PHPUnit\Framework\Error` in the same way that `PHPUnit_Framework_Error_Warning` mapped to `PHPUnit\Framework\Error\Warning`, this base class was replaced with `PHPUnit\Framework\Error\Error`, so we cannot map it using simple string replacement like its descendants. Commits ------- 8e607b5 [PhpUnitBridge] Fix class_alias() for PHPUnit\Framework\Error\Error
2 parents cbb0b1d + 8e607b5 commit 72ff401

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\PhpUnit\Tests;
13+
14+
use PHPUnit\Framework\TestCase;
15+
16+
class BootstrapTest extends TestCase
17+
{
18+
/**
19+
* @requires PHPUnit < 6.0
20+
*/
21+
public function testAliasingOfErrorClasses()
22+
{
23+
$this->assertInstanceOf(
24+
\PHPUnit_Framework_Error::class,
25+
new \PHPUnit\Framework\Error\Error('message', 0, __FILE__, __LINE__)
26+
);
27+
$this->assertInstanceOf(
28+
\PHPUnit_Framework_Error_Deprecated::class,
29+
new \PHPUnit\Framework\Error\Deprecated('message', 0, __FILE__, __LINE__)
30+
);
31+
$this->assertInstanceOf(
32+
\PHPUnit_Framework_Error_Notice::class,
33+
new \PHPUnit\Framework\Error\Notice('message', 0, __FILE__, __LINE__)
34+
);
35+
$this->assertInstanceOf(
36+
\PHPUnit_Framework_Error_Warning::class,
37+
new \PHPUnit\Framework\Error\Warning('message', 0, __FILE__, __LINE__)
38+
);
39+
}
40+
}

src/Symfony/Bridge/PhpUnit/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
'PHPUnit_Framework_Constraint_TraversableContains',
5757
'PHPUnit_Framework_Constraint_TraversableContainsOnly',
5858

59-
'PHPUnit_Framework_Error',
6059
'PHPUnit_Framework_Error_Deprecated',
6160
'PHPUnit_Framework_Error_Notice',
6261
'PHPUnit_Framework_Error_Warning',
@@ -100,6 +99,7 @@ class_alias('PHPUnit_Framework_Constraint_And', 'PHPUnit\Framework\Constraint\Lo
10099
class_alias('PHPUnit_Framework_Constraint_Not', 'PHPUnit\Framework\Constraint\LogicalNot');
101100
class_alias('PHPUnit_Framework_Constraint_Or', 'PHPUnit\Framework\Constraint\LogicalOr');
102101
class_alias('PHPUnit_Framework_Constraint_Xor', 'PHPUnit\Framework\Constraint\LogicalXor');
102+
class_alias('PHPUnit_Framework_Error', 'PHPUnit\Framework\Error\Error');
103103
}
104104

105105
// Detect if we need to serialize deprecations to a file.

0 commit comments

Comments
 (0)
0