Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Mar 25, 2024
1 parent 91dc2c0 commit 413d10b
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/Concerns/InteractsWithMigrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,28 @@ trait InteractsWithMigrations
*/
protected $cachedTestSchemaMigrators = [];

/**
* Setup the test environment.
*
* @return void
*/
protected function setUpInteractsWithMigrations(): void
{
$this->afterApplicationCreated(function () {
if (static::usesSqliteInMemoryDatabaseConnection()) {
static::usesTestingFeature(new ResetRefreshDatabaseState());
}
});
}

/**
* Teardown the test environment.
*
* @return void
*/
protected function tearDownInteractsWithMigrations(): void
{
if (
\count($this->cachedTestSchemaMigrators) > 0
&& (static::usesRefreshDatabaseTestingConcern() || static::usesSqliteInMemoryDatabaseConnection())
) {
if (\count($this->cachedTestSchemaMigrators) > 0 && static::usesRefreshDatabaseTestingConcern()) {
ResetRefreshDatabaseState::run();
}

Expand Down

0 comments on commit 413d10b

Please sign in to comment.