test available set seeds
This commit is contained in:
parent
3d96a8d316
commit
4dfea4ebb3
1 changed files with 24 additions and 0 deletions
|
|
@ -3,8 +3,10 @@
|
||||||
namespace Tests\Feature\Database;
|
namespace Tests\Feature\Database;
|
||||||
|
|
||||||
use App\Auth\PasswordHasher;
|
use App\Auth\PasswordHasher;
|
||||||
|
use App\Set\SetRepository;
|
||||||
use App\Shared\ValueObject\EmailAddress;
|
use App\Shared\ValueObject\EmailAddress;
|
||||||
use App\User\UserRepository;
|
use App\User\UserRepository;
|
||||||
|
use Database\Seeders\UserSeeder;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
|
@ -36,4 +38,26 @@ class DatabaseSeederTest extends TestCase
|
||||||
$user->getPasswordHash(),
|
$user->getPasswordHash(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_it_seeds_the_available_sets_idempotently(): void
|
||||||
|
{
|
||||||
|
$this->seed();
|
||||||
|
$this->seed();
|
||||||
|
|
||||||
|
$sets = app(SetRepository::class)->all();
|
||||||
|
|
||||||
|
$this->assertDatabaseCount('sets', 3);
|
||||||
|
$this->assertSame(
|
||||||
|
['Bible', 'Course', 'Fitness Program'],
|
||||||
|
array_map(function ($set): string {
|
||||||
|
return $set->getName();
|
||||||
|
}, $sets),
|
||||||
|
);
|
||||||
|
foreach ($sets as $set) {
|
||||||
|
$this->assertSame(
|
||||||
|
UserSeeder::EMAIL,
|
||||||
|
$set->getCreator()->getEmail()->value(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue