modelWithPolicy('collections', ['permission:collections.update']) ->loginAs(['collections.update']) ->putJson( route("api.collections.update", $collection = $this->one(Collection::class)), $update = $this->make(Collection::class, withDependency: true) ) ->assertOk(); } /** * @testWith * ["name:gt"] */ public function test_collection_update_unprocessable($field) { $this->modelWithPolicy('collections', ['permission:collections.update']) ->loginAs(['collections.update'])->putJson( route("api.collections.update", $collection = $this->one(Collection::class)), $update = $this->make(collection::class, smash: $field, withDependency: true) ) ->assertUnprocessable(); } public function test_collection_update_forbidden() { $this->modelWithPolicy('collections', ['permission:collections.update']) ->loginAs(['wrong.permission']) ->putJson( route("api.collections.update", $collection = $this->one(Collection::class)), [] ) ->assertForbidden(); } public function test_collection_update_not_found() { $this->loginAsUser(['collections.update']) ->putJson(route("api.collections.update", 0), []) ->assertNotFound(); } }