write test for another items and change some part of the code
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user