Skip to content

Commit 14925cb

Browse files
committed
Use triggering file to determine weak vendors if when the test is run in a separate process
1 parent dd28a32 commit 14925cb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public static function register($mode = 0)
121121
$msg = $parsedMsg['deprecation'];
122122
$class = $parsedMsg['class'];
123123
$method = $parsedMsg['method'];
124+
$isWeak = DeprecationErrorHandler::MODE_WEAK === $mode || (DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $isVendor = $inVendors($parsedMsg['triggering_file']));
124125
} else {
125126
$class = isset($trace[$i]['object']) ? get_class($trace[$i]['object']) : $trace[$i]['class'];
126127
$method = $trace[$i]['function'];
@@ -261,7 +262,7 @@ public static function collectDeprecations($outputFile)
261262

262263
return $ErrorHandler::handleError($type, $msg, $file, $line, $context);
263264
}
264-
$deprecations[] = array(error_reporting(), $msg);
265+
$deprecations[] = array(error_reporting(), $msg, $file);
265266
});
266267

267268
register_shutdown_function(function () use ($outputFile, &$deprecations) {

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,11 @@ public function endTest($test, $time)
272272
unlink($this->runsInSeparateProcess);
273273
putenv('SYMFONY_DEPRECATIONS_SERIALIZE');
274274
foreach ($deprecations ? unserialize($deprecations) : array() as $deprecation) {
275+
$error = serialize(array('deprecation' => $deprecation[1], 'class' => $className, 'method' => $test->getName(false), 'triggering_file' => $deprecation[2]));
275276
if ($deprecation[0]) {
276-
trigger_error(serialize(array('deprecation' => $deprecation[1], 'class' => $className, 'method' => $test->getName(false))), E_USER_DEPRECATED);
277+
trigger_error($error, E_USER_DEPRECATED);
277278
} else {
278-
@trigger_error(serialize(array('deprecation' => $deprecation[1], 'class' => $className, 'method' => $test->getName(false))), E_USER_DEPRECATED);
279+
@trigger_error($error, E_USER_DEPRECATED);
279280
}
280281
}
281282
$this->runsInSeparateProcess = false;

0 commit comments

Comments
 (0)