Skip to content

Commit

Permalink
[5.7] DB seed function in testing now accept an array too (#26734)
Browse files Browse the repository at this point in the history
* DB seed function in testing now accept an array too

* add Arr class to make array

* Update InteractsWithDatabase.php

* Update InteractsWithDatabase.php
  • Loading branch information
johannebert authored and taylorotwell committed Dec 4, 2018
1 parent 24d51b9 commit ee01074
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit ee01074

Please sign in to comment.