trashed()->createOne(); $response = patch(route('api.studio.restore', ['studio' => $studio])); $response->assertUnauthorized(); }); test('forbidden', function (): void { $studio = Studio::factory()->trashed()->createOne(); $user = User::factory()->createOne(); Sanctum::actingAs($user); $response = patch(route('api.studio.restore', ['studio' => $studio])); $response->assertForbidden(); }); test('trashed', function (): void { $studio = Studio::factory()->createOne(); $user = User::factory()->withPermissions(ExtendedCrudPermission::RESTORE->format(Studio::class))->createOne(); Sanctum::actingAs($user); $response = patch(route('api.studio.restore', ['studio' => $studio])); $response->assertOk(); }); test('restored', function (): void { $studio = Studio::factory()->trashed()->createOne(); $user = User::factory()->withPermissions(ExtendedCrudPermission::RESTORE->format(Studio::class))->createOne(); Sanctum::actingAs($user); $response = patch(route('api.studio.restore', ['studio' => $studio])); $response->assertOk(); $this->assertNotSoftDeleted($studio); });