You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
519 B
25 lines
519 B
<?php
|
|
|
|
namespace Tests\Traits;
|
|
|
|
use Illuminate\Contracts\Console\Kernel;
|
|
|
|
trait DatabaseMigrateSeeds
|
|
{
|
|
/**
|
|
* Define hooks to migrate the database before and after each test.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function runDatabaseMigrateSeeds()
|
|
{
|
|
$this->artisan('migrate');
|
|
$this->artisan('db:seed');
|
|
|
|
$this->app[Kernel::class]->setArtisan(null);
|
|
|
|
$this->beforeApplicationDestroyed(function () {
|
|
$this->artisan('migrate:rollback');
|
|
});
|
|
}
|
|
}
|