modelWithPolicy('collections', ['permission:collections.show']) ->loginAs(['collections.show']) ->getJson(route("api.collections.show", $collection = $this->one(Collection::class))) ->assertOk(); } public function test_collection_show_not_found() { $this->modelWithPolicy('collections', ['permission:collections.show']) ->loginAs(['collections.show']) ->getJson(route("api.collections.show", 0)) ->assertNotFound(); } public function test_collection_show_forbidden() { $this->modelWithPolicy('collections', ['permission:collections.show']) ->loginAs(['wrong.permission']) ->getJson(route("api.collections.show", $collection = $this->one(Collection::class)), []) ->assertForbidden(); } }