create(new CreateUserDto( email: new EmailAddress('Founder@EXAMPLE.COM'), )); $this->assertGreaterThan(0, $user->getId()); $this->assertSame( 'Founder@example.com', $user->getEmail()->value(), ); $this->assertDatabaseHas('users', [ 'id' => $user->getId(), 'email' => 'Founder@example.com', ]); $foundUser = $repository->find($user->getId()); $this->assertNotNull($foundUser); $this->assertSame($user->getId(), $foundUser->getId()); $this->assertSame( $user->getEmail()->value(), $foundUser->getEmail()->value(), ); } public function test_it_returns_null_for_an_unknown_user(): void { $repository = app(UserRepository::class); $this->assertNull($repository->find(999)); } }