Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/tests/Integration/Services/Users/UserDeletionServiceTest.php
10279 views
1
<?php
2
3
namespace Pterodactyl\Tests\Integration\Services\Users;
4
5
use Pterodactyl\Models\User;
6
use Pterodactyl\Exceptions\DisplayException;
7
use Pterodactyl\Services\Users\UserDeletionService;
8
use Pterodactyl\Tests\Integration\IntegrationTestCase;
9
10
class UserDeletionServiceTest extends IntegrationTestCase
11
{
12
public function testExceptionReturnedIfUserAssignedToServers(): void
13
{
14
$server = $this->createServerModel();
15
16
$this->expectException(DisplayException::class);
17
$this->expectExceptionMessage(__('admin/user.exceptions.user_has_servers'));
18
19
$this->app->make(UserDeletionService::class)->handle($server->user);
20
21
$this->assertModelExists($server->user);
22
}
23
24
public function testUserIsDeleted(): void
25
{
26
$user = User::factory()->create();
27
28
$this->app->make(UserDeletionService::class)->handle($user);
29
30
$this->assertModelMissing($user);
31
}
32
}
33
34