seed(); $this->seed(); $this->assertDatabaseHas('users', [ 'email' => 'user@example.com', ]); $this->assertDatabaseMissing('users', [ 'email' => 'user@example.com', 'passwordHash' => 'password', ]); $this->assertDatabaseCount('users', 1); $user = app(UserRepository::class)->findByEmail( new EmailAddress('user@example.com'), ); $this->assertNotNull($user); $this->assertTrue(app(PasswordHasher::class)->verify( 'password', $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(), ); } } }