Skip to content

Commit cd78a47

Browse files
committed
Hide deprecation message from examples output
1 parent 7a1bddd commit cd78a47

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/ExamplesTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55
use Generator;
66

77
use function bin2hex;
8+
use function error_reporting;
89
use function getenv;
910
use function putenv;
1011
use function random_bytes;
1112
use function sprintf;
1213

14+
use const E_ALL;
15+
use const E_DEPRECATED;
16+
1317
/** @runTestsInSeparateProcesses */
1418
final class ExamplesTest extends FunctionalTestCase
1519
{
@@ -304,7 +308,14 @@ public function testWithTransaction(): void
304308

305309
private function assertExampleOutput(string $file, string $expectedOutput): void
306310
{
307-
require $file;
311+
// Hide deprecation messages
312+
$level = error_reporting(E_ALL ^ E_DEPRECATED);
313+
314+
try {
315+
require $file;
316+
} finally {
317+
error_reporting($level);
318+
}
308319

309320
$this->assertStringMatchesFormat($expectedOutput, $this->getActualOutputForAssertion());
310321
}

0 commit comments

Comments
 (0)