您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

RegistrationTest.php 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace Tests\Feature;
  3. use Illuminate\Foundation\Testing\RefreshDatabase;
  4. use Laravel\Fortify\Features;
  5. use Tests\TestCase;
  6. use Wallo\FilamentCompanies\FilamentCompanies;
  7. class RegistrationTest extends TestCase
  8. {
  9. use RefreshDatabase;
  10. public function test_registration_screen_can_be_rendered(): void
  11. {
  12. if (! Features::enabled(Features::registration())) {
  13. $this->markTestSkipped('Registration support is not enabled.');
  14. return;
  15. }
  16. $response = $this->get('/register');
  17. $response->assertStatus(200);
  18. }
  19. public function test_registration_screen_cannot_be_rendered_if_support_is_disabled(): void
  20. {
  21. if (Features::enabled(Features::registration())) {
  22. $this->markTestSkipped('Registration support is enabled.');
  23. return;
  24. }
  25. $response = $this->get('/register');
  26. $response->assertStatus(404);
  27. }
  28. public function test_new_users_can_register(): void
  29. {
  30. if (! Features::enabled(Features::registration())) {
  31. $this->markTestSkipped('Registration support is not enabled.');
  32. return;
  33. }
  34. $response = $this->post('/register', [
  35. 'name' => 'Test User',
  36. 'email' => 'test@example.com',
  37. 'password' => 'password',
  38. 'password_confirmation' => 'password',
  39. 'terms' => FilamentCompanies::hasTermsAndPrivacyPolicyFeature(),
  40. ]);
  41. $this->assertAuthenticated();
  42. $response->assertRedirect(config('filament.path'));
  43. }
  44. }