Files
eatvio-infra/tests/Feature/RegistrationTest.php
Anatoliy Poloz a6dec71ac1 init commit
2022-05-13 08:07:15 +00:00

83 lines
2.4 KiB
PHP

<?php
namespace Tests\Feature;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Laravel\Fortify\Features;
use Laravel\Jetstream\Jetstream;
use Tests\TestCase;
class RegistrationTest extends TestCase
{
use RefreshDatabase;
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.');
}
$testUserData = [
'name' => 'Test User',
'email' => 'test@example.com',
'password' => 'password',
'password_confirmation' => 'password',
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature(),
'first_name' => 'Test',
'last_name' => 'User',
'birthdate' => '1980-02-21',
'gender' => 'male',
'country' => 'ru',
'city' => 'Moscow',
'lang' => 'ru',
'weight' => '89',
'chest_circumference' => 90,
'waist_circumference' => 60,
'hip_circumference' => 90,
'blood_pressure_up' => 120,
'blood_pressure_down' => 240,
'has_hypo' => '0',
'has_hyper' => '1',
'about_alergy' => '',
'about_taking_pils' => '',
'about_sport_hobbies' => '',
'favorite_foods' => '',
'unfavorite_foods' => '',
'additional_info' => '',
];
$response = $this->post('/register', $testUserData);
/* $response->dumpHeaders(); */
/* $response->dumpSession(); */
$this->assertAuthenticated();
$response->assertRedirect(RouteServiceProvider::HOME);
}
}