Skip to content

Commit

Permalink
TASK: Reset Bootstrap::$staticObjectManager after functional test
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stephanschuler committed Nov 5, 2021
1 parent 6eee760 commit e2bf2e8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Tests/Functional/ThrowableStorage/CompoundStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

}

0 comments on commit e2bf2e8

Please sign in to comment.