Skip to content

Commit

Permalink
Laravel - filter migration queries when running in a unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
itsgoingd committed Dec 21, 2019
1 parent 23779d0 commit 949722b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Clockwork/Support/Laravel/ClockworkServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ protected function registerDataSources()
}, 'early');
}

if ($app->runningUnitTests()) {
$dataSource->addFilter(function ($query, $trace) {
return ! $trace->first(StackFilter::make()->isClass([
\Illuminate\Database\Migrations\Migrator::class,
\Illuminate\Database\Console\Migrations\MigrateCommand::class
]));
});
}

return $dataSource;
});

Expand Down

0 comments on commit 949722b

Please sign in to comment.