Skip to content

Commit

Permalink
fix(testing): WithTestObject will correctly remove table after test.
Browse files Browse the repository at this point in the history
  • Loading branch information
LastDragon-ru committed Apr 29, 2024
1 parent 746c4c5 commit 5f3b1ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* @internal
*
* @mixin TestCase
* @phpstan-require-extends TestCase
*/
trait WithTestObject {
/**
Expand Down Expand Up @@ -43,11 +43,7 @@ protected function withTestObjectAfter(): void {
$schema = Container::getInstance()->make(Builder::class);
$table = (new TestObject())->getTable();

if ($schema->hasTable($table)) {
return;
}

$schema->drop($table);
$schema->dropIfExists($table);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* @internal
*
* @mixin TestCase
* @phpstan-require-extends TestCase
*/
trait WithTestObject {
/**
Expand Down Expand Up @@ -44,11 +44,7 @@ protected function withTestObjectAfter(): void {
$schema = Container::getInstance()->make(Builder::class);
$table = (new TestObject())->getTable();

if ($schema->hasTable($table)) {
return;
}

$schema->drop($table);
$schema->dropIfExists($table);
});
}
}

0 comments on commit 5f3b1ab

Please sign in to comment.