assertFalse("it's not mohammad's fault, I'm waiting for dynamic policy"); // } public function test_user_with_permission_can_delete_file() { $file = $this->one(File::class, dependencyAttributes: ['withImage' => true]); $collection = Collection::find($file->collection_id); $response = $this->loginAs()->deleteJson(route('api.files.destroy', ['collection_name' => $collection->name, 'uuid' => $file->uuid, 'extention' => $collection->ext])); $response->assertok(); } public function test_file_restore_success() { $this->modelWithPolicy('collections', ['permission:collections.restore']) ->loginAsUser(['collections.restore']) ->deleteJson(route("api.collections.destroy", $collection = $this->trashed(Collection::class, dependencyAttributes: ['withImage' => true]))) ->assertOk(); $this->loginAsAdmin() ->getJson(route("api.collections.show", $collection)) ->assertOk(); } public function test_file_delete_notFound() { $this->loginAsAdmin() ->deleteJson(route("api.files.destroy", ['collection_name' => 'not found', 'uuid' => 'wrong uuid', 'extention' => 'wrong ext'])) ->assertNotFound(); } }