Prime-Chat/tests/Feature/Auth/RegistrationTest.php

25 lines
607 B
PHP
Raw Permalink Normal View History

2024-12-19 07:21:23 +04:00
<?php
2025-01-16 22:22:38 +04:00
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
2024-12-19 07:21:23 +04:00
test('registration screen can be rendered', function () {
$response = $this->get('/register');
$response->assertStatus(200);
});
test('new users can register', function () {
$response = $this->post('/register', [
'name' => 'Test User',
'email' => 'test@example.com',
2025-01-16 22:22:38 +04:00
'role' => 2,
2024-12-19 07:21:23 +04:00
'password' => 'password',
'password_confirmation' => 'password',
]);
$this->assertAuthenticated();
2025-01-16 22:22:38 +04:00
$response->assertRedirect(route('profile.edit', absolute: false));
2024-12-19 07:21:23 +04:00
});