From ee01074194cc2aeb5bb317c3a3d0fbf1e2752dbb Mon Sep 17 00:00:00 2001 From: Johann-Mike Ebert <19428345+johannebert@users.noreply.github.com> Date: Tue, 4 Dec 2018 15:02:42 +0100 Subject: [PATCH] [5.7] DB seed function in testing now accept an array too (#26734) * DB seed function in testing now accept an array too * add Arr class to make array * Update InteractsWithDatabase.php * Update InteractsWithDatabase.php --- .../Foundation/Testing/Concerns/InteractsWithDatabase.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php b/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php index 2895165c156f..843e4f6c0bdc 100644 --- a/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php +++ b/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php @@ -2,6 +2,7 @@ namespace Illuminate\Foundation\Testing\Concerns; +use Illuminate\Support\Arr; use Illuminate\Database\Eloquent\Model; use Illuminate\Foundation\Testing\Constraints\HasInDatabase; use PHPUnit\Framework\Constraint\LogicalNot as ReverseConstraint; @@ -84,12 +85,14 @@ protected function getConnection($connection = null) /** * Seed a given database connection. * - * @param string $class + * @param array|string $class * @return $this */ public function seed($class = 'DatabaseSeeder') { - $this->artisan('db:seed', ['--class' => $class, '--no-interaction' => true]); + foreach (Arr::wrap($class) as $class) { + $this->artisan('db:seed', ['--class' => $class, '--no-interaction' => true]); + } return $this; }