createOne(); $response = $this->delete(route('api.artist.forceDelete', ['artist' => $artist])); $response->assertUnauthorized(); } /** * The Artist Force Delete Endpoint shall forbid users without the force delete artist permission. * * @return void */ public function testForbidden(): void { $artist = Artist::factory()->createOne(); $user = User::factory()->createOne(); Sanctum::actingAs($user); $response = $this->delete(route('api.artist.forceDelete', ['artist' => $artist])); $response->assertForbidden(); } /** * The Artist Force Delete Endpoint shall force delete the artist. * * @return void */ public function testDeleted(): void { $artist = Artist::factory()->createOne(); $user = User::factory()->withPermissions(ExtendedCrudPermission::FORCE_DELETE->format(Artist::class))->createOne(); Sanctum::actingAs($user); $response = $this->delete(route('api.artist.forceDelete', ['artist' => $artist])); $response->assertOk(); static::assertModelMissing($artist); } }