laravel-nuxt/tests/Feature/Auth/RegistrationTest.php

30 lines
683 B
PHP

<?php
namespace Tests\Feature\Auth;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Spatie\Permission\Models\Role;
use Tests\TestCase;
class RegistrationTest extends TestCase
{
use RefreshDatabase;
public function test_new_users_can_register(): void
{
$role = Role::create(['name' => 'user']);
$response = $this->post('/api/v1/register', [
'name' => 'Test User',
'email' => 'test@example.com',
'password' => 'password',
'password_confirmation' => 'password',
]);
$response->assertCreated();
$response->assertJson(['ok' => true], true);
$role->delete();
}
}