Skip to content

PHPLIB-816: Cleanup collections created when tests are successful #1075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jun 1, 2023
Merged
10 changes: 5 additions & 5 deletions tests/Collection/CollectionFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function testAggregateWithinTransaction(): void
$this->skipIfTransactionsAreNotSupported();

// Collection must be created before the transaction starts
$this->createCollection();
$this->createCollection($this->getDatabaseName(), $this->getCollectionName());

$session = $this->manager->startSession();
$session->startTransaction();
Expand Down Expand Up @@ -294,7 +294,7 @@ public function testFindWithinTransaction(): void
$this->skipIfTransactionsAreNotSupported();

// Collection must be created before the transaction starts
$this->createCollection();
$this->createCollection($this->getDatabaseName(), $this->getCollectionName());

$session = $this->manager->startSession();
$session->startTransaction();
Expand Down Expand Up @@ -727,7 +727,7 @@ public function testMethodDoesNotInheritReadWriteConcernInTranasaction(Closure $
{
$this->skipIfTransactionsAreNotSupported();

$this->createCollection();
$this->createCollection($this->getDatabaseName(), $this->getCollectionName());

$session = $this->manager->startSession();
$session->startTransaction();
Expand All @@ -753,7 +753,7 @@ public function testMethodInTransactionWithWriteConcernOption($method): void
{
$this->skipIfTransactionsAreNotSupported();

$this->createCollection();
$this->createCollection($this->getDatabaseName(), $this->getCollectionName());

$session = $this->manager->startSession();
$session->startTransaction();
Expand All @@ -773,7 +773,7 @@ public function testMethodInTransactionWithReadConcernOption($method): void
{
$this->skipIfTransactionsAreNotSupported();

$this->createCollection();
$this->createCollection($this->getDatabaseName(), $this->getCollectionName());

$session = $this->manager->startSession();
$session->startTransaction();
Expand Down
3 changes: 1 addition & 2 deletions tests/Collection/CrudSpecFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public function setUp(): void
{
parent::setUp();

$this->expectedCollection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName() . '.expected');
$this->expectedCollection->drop();
$this->expectedCollection = $this->dropCollection($this->getDatabaseName(), $this->getCollectionName() . '.expected');
}

/** @dataProvider provideSpecificationTests */
Expand Down
13 changes: 1 addition & 12 deletions tests/Collection/FunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ public function setUp(): void
{
parent::setUp();

$this->collection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName());

$this->dropCollection();
}

public function tearDown(): void
{
if (! $this->hasFailed()) {
$this->dropCollection();
}

parent::tearDown();
$this->collection = $this->dropCollection($this->getDatabaseName(), $this->getCollectionName());
}
}
Loading