Skip to content

Commit

Permalink
Migration commands parameters moved to methods
Browse files Browse the repository at this point in the history
  • Loading branch information
masterix21 committed Aug 25, 2020
1 parent 7161c83 commit d8aa393
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions src/Illuminate/Foundation/Testing/RefreshDatabase.php
Expand Up @@ -30,18 +30,41 @@ protected function usingInMemoryDatabase()
return config("database.connections.$default.database") === ':memory:';
}

/**
* Parameters used on refresh in-memory database.
*
* @return array
*/
protected function migrateCommandParameters()
{
return [ ];
}

/**
* Refresh the in-memory database.
*
* @return void
*/
protected function refreshInMemoryDatabase()
{
$this->artisan('migrate');
$this->artisan('migrate', $this->migrateCommandParameters());

$this->app[Kernel::class]->setArtisan(null);
}

/**
* Parameters used on migrate fresh conventional database
*
* @return array
*/
protected function migrateFreshCommandParameters()
{
return [
'--drop-views' => $this->shouldDropViews(),
'--drop-types' => $this->shouldDropTypes(),
];
}

/**
* Refresh a conventional test database.
*
Expand All @@ -50,10 +73,7 @@ protected function refreshInMemoryDatabase()
protected function refreshTestDatabase()
{
if (! RefreshDatabaseState::$migrated) {
$this->artisan('migrate:fresh', [
'--drop-views' => $this->shouldDropViews(),
'--drop-types' => $this->shouldDropTypes(),
]);
$this->artisan('migrate:fresh', $this->migrateFreshCommandParameters());

$this->app[Kernel::class]->setArtisan(null);

Expand Down

0 comments on commit d8aa393

Please sign in to comment.