Skip to content

Commit 90c5169

Browse files
committed
Use PHPUnit 9.6 to run Symfony's test suite
1 parent 8a9b99a commit 90c5169

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

Diff for: Tests/DeprecationErrorHandler/ConfigurationTest.php

+17-3
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,24 @@ public function testBaselineFileWriteError()
482482
{
483483
$filename = $this->createFile();
484484
chmod($filename, 0444);
485-
$this->expectError();
486-
$this->expectErrorMessageMatches('/[Ff]ailed to open stream: Permission denied/');
487485
$configuration = Configuration::fromUrlEncodedString('generateBaseline=true&baselineFile='.urlencode($filename));
488-
$configuration->writeBaseline();
486+
487+
$this->expectException(\ErrorException::class);
488+
$this->expectExceptionMessageMatches('/[Ff]ailed to open stream: Permission denied/');
489+
490+
set_error_handler(static function (int $errno, string $errstr, string $errfile = null, int $errline = null): bool {
491+
if ($errno & (E_WARNING | E_WARNING)) {
492+
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
493+
}
494+
495+
return false;
496+
});
497+
498+
try {
499+
$configuration->writeBaseline();
500+
} finally {
501+
restore_error_handler();
502+
}
489503
}
490504

491505
protected function setUp(): void

0 commit comments

Comments
 (0)