RegistrationTest.php 770 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Tests\Feature\Auth;
  3. use App\Providers\RouteServiceProvider;
  4. use Illuminate\Foundation\Testing\RefreshDatabase;
  5. use Tests\TestCase;
  6. class RegistrationTest extends TestCase
  7. {
  8. use RefreshDatabase;
  9. public function test_registration_screen_can_be_rendered()
  10. {
  11. $response = $this->get('/register');
  12. $response->assertStatus(200);
  13. }
  14. public function test_new_users_can_register()
  15. {
  16. $response = $this->post('/register', [
  17. 'name' => 'Test User',
  18. 'email' => 'test@example.com',
  19. 'password' => 'password',
  20. 'password_confirmation' => 'password',
  21. ]);
  22. $this->assertAuthenticated();
  23. $response->assertRedirect(RouteServiceProvider::HOME);
  24. }
  25. }