createOne(); $response = $this->delete(route('api.artist.destroy', ['artist' => $artist])); $response->assertUnauthorized(); } /** * The Artist Destroy Endpoint shall forbid users without the 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.destroy', ['artist' => $artist])); $response->assertForbidden(); } /** * The Artist Destroy Endpoint shall forbid users from updating an artist that is trashed. * * @return void */ public function testTrashed(): void { $artist = Artist::factory()->trashed()->createOne(); $user = User::factory()->withPermissions(CrudPermission::DELETE->format(Artist::class))->createOne(); Sanctum::actingAs($user); $response = $this->delete(route('api.artist.destroy', ['artist' => $artist])); $response->assertNotFound(); } /** * The Artist Destroy Endpoint shall delete the artist. * * @return void */ public function testDeleted(): void { $artist = Artist::factory()->createOne(); $user = User::factory()->withPermissions(CrudPermission::DELETE->format(Artist::class))->createOne(); Sanctum::actingAs($user); $response = $this->delete(route('api.artist.destroy', ['artist' => $artist])); $response->assertOk(); static::assertSoftDeleted($artist); } }