createOne(); $parameters = Dump::factory()->raw(); $response = $this->put(route('api.dump.update', ['dump' => $dump] + $parameters)); $response->assertUnauthorized(); } /** * The Dump Update Endpoint shall forbid users without the update dump permission. * * @return void */ public function testForbidden(): void { $dump = Dump::factory()->createOne(); $parameters = Dump::factory()->raw(); $user = User::factory()->createOne(); Sanctum::actingAs($user); $response = $this->put(route('api.dump.update', ['dump' => $dump] + $parameters)); $response->assertForbidden(); } /** * The Dump Update Endpoint shall forbid users from updating a dump that is trashed. * * @return void */ public function testTrashed(): void { $dump = Dump::factory()->trashed()->createOne(); $parameters = Dump::factory()->raw(); $user = User::factory()->withPermissions(CrudPermission::UPDATE->format(Dump::class))->createOne(); Sanctum::actingAs($user); $response = $this->put(route('api.dump.update', ['dump' => $dump] + $parameters)); $response->assertForbidden(); } /** * The Dump Update Endpoint shall update a dump. * * @return void */ public function testUpdate(): void { $dump = Dump::factory()->createOne(); $parameters = Dump::factory()->raw(); $user = User::factory()->withPermissions(CrudPermission::UPDATE->format(Dump::class))->createOne(); Sanctum::actingAs($user); $response = $this->put(route('api.dump.update', ['dump' => $dump] + $parameters)); $response->assertOk(); } }