write test for another items and change some part of the code

This commit is contained in:
2025-05-14 15:38:33 +03:30
parent db8cda55df
commit 16fe0be555
20 changed files with 1258 additions and 45 deletions

View File

@@ -12,12 +12,20 @@ class DeleteTest extends TestCase
{
use RefreshDatabase, WithFaker;
public function test_unauthenticated_user_cannot_access(): void
{
$permission = Permission::factory()->create();
$response = $this->getJson(route('permissions.destroy',[$permission->id]));
$response->assertUnauthorized();
}
public function test_authenticated_user_can_delete_permission(): void
{
$user = User::factory()->create();
$permission = Permission::factory()->create();
$response = $this->actingAs($user)->deleteJson(route('permissions.destroy', $permission));
$response = $this->actingAs($user)->deleteJson(route('permissions.destroy', [$permission->id]));
$response->assertOk()
->assertJson([
@@ -33,7 +41,7 @@ class DeleteTest extends TestCase
{
$permission = Permission::factory()->create();
$response = $this->deleteJson(route('permissions.destroy', $permission));
$response = $this->deleteJson(route('permissions.destroy', [$permission->id]));
$response->assertUnauthorized();
}