postJson('/api/signup', [ 'email' => 'Founder@EXAMPLE.COM', ]); $response->assertCreated(); $user = app(UserRepository::class)->findByEmail( new EmailAddress('Founder@example.com'), ); $this->assertNotNull($user); $this->assertNull($user->getPasswordHash()); $this->assertNotNull( app(EmailConfirmationTokenRepository::class) ->findByUser($user), ); } public function test_signup_rejects_an_existing_confirmed_account(): void { app(UserRepository::class)->create(new CreateUserDto( email: new EmailAddress('user@example.com'), passwordHash: 'hashed-password', )); $response = $this->postJson('/api/signup', [ 'email' => 'user@example.com', ]); $response->assertConflict(); $response->assertJson([ 'error' => 'user@example.com already has an account', ]); } }