Remove suspended & installing fields, replace with single status field

This commit is contained in:
Dane Everitt 2021-01-17 15:51:56 -08:00
parent 4c29be2e54
commit a75a347d65
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
24 changed files with 115 additions and 59 deletions

View file

@ -4,6 +4,7 @@ namespace Pterodactyl\Tests\Integration\Services\Servers;
use Mockery;
use InvalidArgumentException;
use Pterodactyl\Models\Server;
use Pterodactyl\Services\Servers\SuspensionService;
use Pterodactyl\Tests\Integration\IntegrationTestCase;
use Pterodactyl\Repositories\Wings\DaemonServerRepository;
@ -26,7 +27,7 @@ class SuspensionServiceTest extends IntegrationTestCase
public function testServerIsSuspendedAndUnsuspended()
{
$server = $this->createServerModel(['suspended' => false]);
$server = $this->createServerModel();
$this->repository->expects('setServer')->twice()->andReturnSelf();
$this->repository->expects('suspend')->with(false)->andReturnUndefined();
@ -34,30 +35,30 @@ class SuspensionServiceTest extends IntegrationTestCase
$this->getService()->toggle($server, SuspensionService::ACTION_SUSPEND);
$server->refresh();
$this->assertTrue($server->suspended);
$this->assertTrue($server->isSuspended());
$this->repository->expects('suspend')->with(true)->andReturnUndefined();
$this->getService()->toggle($server, SuspensionService::ACTION_UNSUSPEND);
$server->refresh();
$this->assertFalse($server->suspended);
$this->assertFalse($server->isSuspended());
}
public function testNoActionIsTakenIfSuspensionStatusIsUnchanged()
{
$server = $this->createServerModel(['suspended' => false]);
$server = $this->createServerModel();
$this->getService()->toggle($server, SuspensionService::ACTION_UNSUSPEND);
$server->refresh();
$this->assertFalse($server->suspended);
$this->assertFalse($server->isSuspended());
$server->update(['suspended' => true]);
$server->update(['status' => Server::STATUS_SUSPENDED]);
$this->getService()->toggle($server, SuspensionService::ACTION_SUSPEND);
$server->refresh();
$this->assertTrue($server->suspended);
$this->assertTrue($server->isSuspended());
}
public function testExceptionIsThrownIfInvalidActionsArePassed()