Skip to content

Commit 80ab4b6

Browse files
committed
PHPLIB-1659: Fix dropping collections after successful tests
cb33c1c introduced onNotSuccessfulTest(), but that is the inverse logic. The internal TestCase::status() method seems to be the only replacement for TestCase::hasFailed(), which was removed in PHPUnit 10.
1 parent 08acec8 commit 80ab4b6

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

tests/FunctionalTestCase.php

+4-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use MongoDB\Operation\DatabaseCommand;
1818
use MongoDB\Operation\ListCollections;
1919
use stdClass;
20-
use Throwable;
2120
use UnexpectedValueException;
2221

2322
use function array_intersect_key;
@@ -70,15 +69,12 @@ public function setUp(): void
7069
$this->configuredFailPoints = [];
7170
}
7271

73-
protected function onNotSuccessfulTest(Throwable $t): never
74-
{
75-
$this->cleanupCollections();
76-
77-
throw $t;
78-
}
79-
8072
public function tearDown(): void
8173
{
74+
if ($this->status()->isSuccess()) {
75+
$this->cleanupCollections();
76+
}
77+
8278
$this->disableFailPoints();
8379

8480
parent::tearDown();

0 commit comments

Comments
 (0)