modelWithPolicy('collections', ['permission:collections.store']) ->loginAs(['collections.store']) ->postJson(route('api.collections.store'), $collection = $this->make(Collection::class)) ->assertCreated(); } /** * @testWith * ["name:gt"] */ public function test_collection_store_unprocessable($field) { $this->modelWithPolicy('collections', ['permission:collections.store']) ->loginAsAdmin() ->postJson(route("api.collections.store"), $collection = $this->make(collection::class, smash: $field, withDependency: true)) ->assertUnprocessable(); } public function test_collection_store_forbidden() { $this->modelWithPolicy('collections', ['permission:collections.store']) ->loginAs(['wrong.permission']) ->postJson(route("api.collections.store"), []) ->assertForbidden(); } }