From 84fe494296fb723de08dfc53cd258ec6118feca2 Mon Sep 17 00:00:00 2001 From: Ivan Dokov Date: Wed, 2 Jun 2021 15:54:27 +0300 Subject: [PATCH] Skip tests if registration is disabled (#799) Added checks to skip the tests if the registration support in Fortify is disabled, otherwise the tests fail. --- stubs/tests/RegistrationTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/stubs/tests/RegistrationTest.php b/stubs/tests/RegistrationTest.php index c3fea6f9c..aae144fcd 100644 --- a/stubs/tests/RegistrationTest.php +++ b/stubs/tests/RegistrationTest.php @@ -4,6 +4,7 @@ use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Testing\RefreshDatabase; +use Laravel\Fortify\Features; use Laravel\Jetstream\Jetstream; use Tests\TestCase; @@ -13,13 +14,32 @@ class RegistrationTest extends TestCase public function test_registration_screen_can_be_rendered() { + if (! Features::enabled(Features::registration())) { + return $this->markTestSkipped('Registration support is not enabled.'); + } + $response = $this->get('/register'); $response->assertStatus(200); } + public function test_registration_screen_cannot_be_rendered_if_support_is_disabled() + { + if (Features::enabled(Features::registration())) { + return $this->markTestSkipped('Registration support is enabled.'); + } + + $response = $this->get('/register'); + + $response->assertStatus(404); + } + public function test_new_users_can_register() { + if (! Features::enabled(Features::registration())) { + return $this->markTestSkipped('Registration support is not enabled.'); + } + $response = $this->post('/register', [ 'name' => 'Test User', 'email' => 'test@example.com',