Path: blob/1.0-develop/tests/Integration/Services/Users/UserDeletionServiceTest.php
10279 views
<?php12namespace Pterodactyl\Tests\Integration\Services\Users;34use Pterodactyl\Models\User;5use Pterodactyl\Exceptions\DisplayException;6use Pterodactyl\Services\Users\UserDeletionService;7use Pterodactyl\Tests\Integration\IntegrationTestCase;89class UserDeletionServiceTest extends IntegrationTestCase10{11public function testExceptionReturnedIfUserAssignedToServers(): void12{13$server = $this->createServerModel();1415$this->expectException(DisplayException::class);16$this->expectExceptionMessage(__('admin/user.exceptions.user_has_servers'));1718$this->app->make(UserDeletionService::class)->handle($server->user);1920$this->assertModelExists($server->user);21}2223public function testUserIsDeleted(): void24{25$user = User::factory()->create();2627$this->app->make(UserDeletionService::class)->handle($user);2829$this->assertModelMissing($user);30}31}323334