bug #24597 [PhpUnitBridge] fix deprecation triggering test detection (xabbuh)
This PR was merged into the 3.3 branch.
Discussion
----------
[PhpUnitBridge] fix deprecation triggering test detection
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/24548#issuecomment-336438768, #24568
| License | MIT
| Doc PR |
Commits
-------
da617e8
fix deprecation triggering test detection
This commit is contained in:
commit
4365d23e38
@ -116,8 +116,16 @@ class DeprecationErrorHandler
|
||||
}
|
||||
|
||||
if (isset($trace[$i]['object']) || isset($trace[$i]['class'])) {
|
||||
$class = isset($trace[$i]['object']) ? get_class($trace[$i]['object']) : $trace[$i]['class'];
|
||||
$method = $trace[$i]['function'];
|
||||
if (isset($trace[$i]['class']) && in_array($trace[$i]['class'], array('Symfony\Bridge\PhpUnit\SymfonyTestsListener', 'Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener'), true)) {
|
||||
$parsedMsg = unserialize($msg);
|
||||
$msg = $parsedMsg['deprecation'];
|
||||
$class = $parsedMsg['class'];
|
||||
$method = $parsedMsg['method'];
|
||||
} else {
|
||||
$class = isset($trace[$i]['object']) ? get_class($trace[$i]['object']) : $trace[$i]['class'];
|
||||
$method = $trace[$i]['function'];
|
||||
}
|
||||
|
||||
$Test = $UtilPrefix.'Test';
|
||||
|
||||
if (0 !== error_reporting()) {
|
||||
|
@ -264,9 +264,9 @@ class SymfonyTestsListenerTrait
|
||||
unlink($this->runsInSeparateProcess);
|
||||
foreach ($deprecations ? unserialize($deprecations) : array() as $deprecation) {
|
||||
if ($deprecation[0]) {
|
||||
trigger_error($deprecation[1], E_USER_DEPRECATED);
|
||||
trigger_error(serialize(array('deprecation' => $deprecation[1], 'class' => $className, 'method' => $test->getName(false))), E_USER_DEPRECATED);
|
||||
} else {
|
||||
@trigger_error($deprecation[1], E_USER_DEPRECATED);
|
||||
@trigger_error(serialize(array('deprecation' => $deprecation[1], 'class' => $className, 'method' => $test->getName(false))), E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
$this->runsInSeparateProcess = false;
|
||||
|
Reference in New Issue
Block a user