From e2bf2e85488918154ed95ee776eebce1f1417c82 Mon Sep 17 00:00:00 2001 From: Stephan Schuler Date: Fri, 5 Nov 2021 17:18:14 +0100 Subject: [PATCH] TASK: Reset Bootstrap::$staticObjectManager after functional test PHPUnit does not reset this public static property automatically, which means it will be null for every upcomming test. This leads to exceptions in FunctionalTestCase::setupBeforeClass() for every upcomming tests, regardless of the actual test code. --- .../ThrowableStorage/CompoundStorageTest.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Tests/Functional/ThrowableStorage/CompoundStorageTest.php b/Tests/Functional/ThrowableStorage/CompoundStorageTest.php index dd2e278..8262398 100644 --- a/Tests/Functional/ThrowableStorage/CompoundStorageTest.php +++ b/Tests/Functional/ThrowableStorage/CompoundStorageTest.php @@ -84,14 +84,19 @@ public function When_Bootstrap_staticObjectManager_is_unset_the_logged_exception ] ]); + self::expectException(Test::class); + self::expectExceptionCode(1); + + $staticObjectManager = Bootstrap::$staticObjectManager; Bootstrap::$staticObjectManager = null; $throwable = new Test('foo', 1); - self::expectException(Test::class); - self::expectExceptionCode(1); - - $storage->logThrowable($throwable); + try { + $storage->logThrowable($throwable); + } finally { + Bootstrap::$staticObjectManager = $staticObjectManager; + } } }