Skip to content

PHPLIB-693: Remove early returns for failed tests from tearDown methods #1071

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 1 commit into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions tests/Collection/FunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ public function setUp(): void

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

$this->dropCollection();

parent::tearDown();
}
}
6 changes: 2 additions & 4 deletions tests/DocumentationExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ public function setUp(): void

public function tearDown(): void
{
if ($this->hasFailed()) {
return;
if (! $this->hasFailed()) {
$this->dropCollection();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted that this will likely change in #1075 but it's fine for this PR.

}

$this->dropCollection();

parent::tearDown();
}

Expand Down
6 changes: 2 additions & 4 deletions tests/Model/IndexInfoFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ public function setUp(): void

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

$this->collection->drop();

parent::tearDown();
}

Expand Down
6 changes: 2 additions & 4 deletions tests/Operation/FunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ public function setUp(): void

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

$this->dropCollection();

parent::tearDown();
}

Expand Down
8 changes: 3 additions & 5 deletions tests/Operation/RenameCollectionFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ public function setUp(): void

public function tearDown(): void
{
if ($this->hasFailed()) {
return;
if (! $this->hasFailed()) {
$operation = new DropCollection($this->getDatabaseName(), $this->toCollectionName);
$operation->execute($this->getPrimaryServer());
}

$operation = new DropCollection($this->getDatabaseName(), $this->toCollectionName);
$operation->execute($this->getPrimaryServer());

parent::tearDown();
}

Expand Down