Skip to content

Commit

Permalink
Fix seeder property for in-memory tests (#41869)
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed Apr 7, 2022
1 parent 45de4c4 commit 76a7b3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Expand Up @@ -24,6 +24,7 @@ class MigrateCommand extends BaseCommand
{--schema-path= : The path to a schema dump file}
{--pretend : Dump the SQL queries that would be run}
{--seed : Indicates if the seed task should be re-run}
{--seeder= : The class name of the root seeder}
{--step : Force the migrations to be run so they can be rolled back individually}';

/**
Expand Down Expand Up @@ -89,7 +90,10 @@ public function handle()
// seed task to re-populate the database, which is convenient when adding
// a migration and a seed at the same time, as it is only this command.
if ($this->option('seed') && ! $this->option('pretend')) {
$this->call('db:seed', ['--force' => true]);
$this->call('db:seed', [
'--class' => $this->option('seeder') ?: 'Database\\Seeders\\DatabaseSeeder',
'--force' => true,
]);
}
});

Expand Down
1 change: 1 addition & 0 deletions src/Illuminate/Foundation/Testing/RefreshDatabase.php
Expand Up @@ -56,6 +56,7 @@ protected function migrateUsing()
{
return [
'--seed' => $this->shouldSeed(),
'--seeder' => $this->seeder(),
];
}

Expand Down

0 comments on commit 76a7b3c

Please sign in to comment.