Skip to content

Commit a09c2a6

Browse files
committed
minor #18296 [3.1] fix testing deprecation messages (xabbuh)
This PR was merged into the 3.1-dev branch. Discussion ---------- [3.1] fix testing deprecation messages | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | * always restore the previous error handler * throw `LogicExcetion` when unexpected error type is triggered Commits ------- 0df544f fix testing deprecation messages
2 parents a625d5d + 418d164 commit a09c2a6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Tests/Fragment/EsiFragmentRendererTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ public function testRenderFallbackWithObjectAttributesIsDeprecated()
3232
{
3333
$deprecations = array();
3434
set_error_handler(function ($type, $message) use (&$deprecations) {
35-
if (E_USER_DEPRECATED === $type) {
36-
$deprecations[] = $message;
35+
if (E_USER_DEPRECATED !== $type) {
36+
restore_error_handler();
37+
38+
return call_user_func_array('PHPUnit_Util_ErrorHandler::handleError', func_get_args());
3739
}
40+
41+
$deprecations[] = $message;
3842
});
3943

4044
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo'));
@@ -45,10 +49,10 @@ public function testRenderFallbackWithObjectAttributesIsDeprecated()
4549

4650
$strategy->render($reference, $request);
4751

52+
restore_error_handler();
53+
4854
$this->assertCount(1, $deprecations);
4955
$this->assertContains('Passing objects as part of URI attributes to the ESI and SSI rendering strategies is deprecated', $deprecations[0]);
50-
51-
restore_error_handler();
5256
}
5357

5458
public function testRender()

0 commit comments

Comments
 (0)