Skip to content

Commit dd0446c

Browse files
committed
Replace hasFailed with onNotSuccessfulTest
sebastianbergmann/phpunit#5687
1 parent f48c9c2 commit dd0446c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/FunctionalTestCase.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use MongoDB\Operation\DatabaseCommand;
1818
use MongoDB\Operation\ListCollections;
1919
use stdClass;
20+
use Throwable;
2021
use UnexpectedValueException;
2122

2223
use function array_intersect_key;
@@ -69,12 +70,15 @@ public function setUp(): void
6970
$this->configuredFailPoints = [];
7071
}
7172

72-
public function tearDown(): void
73+
protected function onNotSuccessfulTest(Throwable $t): never
7374
{
74-
if (! $this->hasFailed()) {
75-
$this->cleanupCollections();
76-
}
75+
$this->cleanupCollections();
76+
77+
throw $t;
78+
}
7779

80+
public function tearDown(): void
81+
{
7882
$this->disableFailPoints();
7983

8084
parent::tearDown();

0 commit comments

Comments
 (0)