create(); $azmayeshSample = AzmayeshSample::factory()->create(); $response = $this->actingAs($user)->postJson(route('v3.azmayesh_samples.delete', [$azmayeshSample->id])); $response->assertForbidden(); } public function test_user_can_delete_azmayesh_sample(): void { $user = User::factory() ->has(Permission::factory([ 'name' => 'azmayesh-management' ])) ->create(); $azmayeshSample = AzmayeshSample::factory()->create(); $response = $this->actingAs($user)->postJson(route('v3.azmayesh_samples.delete', [$azmayeshSample->id])); $response->assertOk(); $this->assertDatabaseMissing('azmayesh_samples', [ 'azmayesh_id' => $azmayeshSample->azmayesh_id, 'data' => $azmayeshSample->data, ]); } }