Skip to content

Commit

Permalink
[10.x] Fix $exceptTables to allow an array of table names (#47477)
Browse files Browse the repository at this point in the history
* Change `DatabaseTruncation` to look for an array of table names in `$exceptTables` if a connection name is not found.

* formatting

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
cwilby and taylorotwell authored Jun 18, 2023
1 parent ab4c615 commit a0e03b0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Illuminate/Foundation/Testing/DatabaseTruncation.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,18 @@ protected function connectionsToTruncate(): array
protected function exceptTables(?string $connectionName): array
{
if (property_exists($this, 'exceptTables')) {
$migrationsTable = $this->app['config']->get('database.migrations');

if (array_is_list($this->exceptTables ?? [])) {
return array_merge(
$this->exceptTables ?? [],
[$migrationsTable],
);
}

return array_merge(
$this->exceptTables[$connectionName] ?? [],
[$this->app['config']->get('database.migrations')]
[$migrationsTable],
);
}

Expand Down

0 comments on commit a0e03b0

Please sign in to comment.