RegistrationTest.php 886 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Tests\Feature\Auth;
  3. use Illuminate\Foundation\Testing\RefreshDatabase;
  4. use Livewire\Volt\Volt;
  5. use Tests\TestCase;
  6. class RegistrationTest extends TestCase
  7. {
  8. use RefreshDatabase;
  9. public function test_registration_screen_can_be_rendered(): void
  10. {
  11. $response = $this->get('/register');
  12. $response
  13. ->assertOk()
  14. ->assertSeeVolt('pages.auth.register');
  15. }
  16. public function test_new_users_can_register(): void
  17. {
  18. $component = Volt::test('pages.auth.register')
  19. ->set('name', 'Test User')
  20. ->set('email', 'test@example.com')
  21. ->set('password', 'password')
  22. ->set('password_confirmation', 'password');
  23. $component->call('register');
  24. $component->assertRedirect(route('dashboard', absolute: false));
  25. $this->assertAuthenticated();
  26. }
  27. }