8000 Ensure DeprecationErrorHandler::collectDeprecations() is triggered · symfony/symfony@e7da160 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7da160

Browse files
alexpottnicolas-grekas
authored andcommitted
Ensure DeprecationErrorHandler::collectDeprecations() is triggered
1 parent 3e3e74c commit e7da160

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ public function endTest($test, $time)
262262
if ($this->runsInSeparateProcess) {
263263
$deprecations = file_get_contents($this->runsInSeparateProcess);
264264
unlink($this->runsInSeparateProcess);
265+
putenv('SYMFONY_DEPRECATIONS_SERIALIZE');
265266
foreach ($deprecations ? unserialize($deprecations) : array() as $deprecation) {
266267
if ($deprecation[0]) {
267268
trigger_error(serialize(array('deprecation' => $deprecation[1], 'class' => $className, 'method' => $test->getName(false))), E_USER_DEPRECATED);

src/Symfony/Bridge/PhpUnit/bootstrap.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212
use Doctrine\Common\Annotations\AnnotationRegistry;
1313
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
1414

15+
// Detect if we need to serialize deprecations to a file.
16+
if ($file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
17+
DeprecationErrorHandler::collectDeprecations($file);
18+
19+
return;
20+
}
21+
1522
// Detect if we're loaded by an actual run of phpunit
1623
if (!defined('PHPUNIT_COMPOSER_INSTALL') && !class_exists('PHPUnit_TextUI_Command', false) && !class_exists('PHPUnit\TextUI\Command', false)) {
17-
if ($ser = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
18-
DeprecationErrorHandler::collectDeprecations($ser);
19-
}
20-
2124
return;
2225
}
2326

0 commit comments

Comments
 (0)
0