Skip to content

Commit

Permalink
Skip tests if registration is disabled (#799)
Browse files Browse the repository at this point in the history
Added checks to skip the tests if the registration support in Fortify is disabled, otherwise the tests fail.
  • Loading branch information
ivandokov authored Jun 2, 2021
1 parent 05fa160 commit 84fe494
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions stubs/tests/RegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Laravel\Fortify\Features;
use Laravel\Jetstream\Jetstream;
use Tests\TestCase;

Expand All @@ -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',
Expand Down

0 comments on commit 84fe494

Please sign in to comment.