Skip to content

Commit a0e03b0

Browse files
cwilbytaylorotwell
andauthored
[10.x] Fix $exceptTables to allow an array of table names (#47477)
* 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 <[email protected]>
1 parent ab4c615 commit a0e03b0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Illuminate/Foundation/Testing/DatabaseTruncation.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,18 @@ protected function connectionsToTruncate(): array
111111
protected function exceptTables(?string $connectionName): array
112112
{
113113
if (property_exists($this, 'exceptTables')) {
114+
$migrationsTable = $this->app['config']->get('database.migrations');
115+
116+
if (array_is_list($this->exceptTables ?? [])) {
117+
return array_merge(
118+
$this->exceptTables ?? [],
119+
[$migrationsTable],
120+
);
121+
}
122+
114123
return array_merge(
115124
$this->exceptTables[$connectionName] ?? [],
116-
[$this->app['config']->get('database.migrations')]
125+
[$migrationsTable],
117126
);
118127
}
119128

0 commit comments

Comments
 (0)