Files
panel/tests/Integration/Services/Deployment/FindViableNodesServiceTest.php

43 lines
1.1 KiB
PHP
Raw Normal View History

<?php
2024-03-12 22:39:16 -04:00
namespace App\Tests\Integration\Services\Deployment;
2024-03-12 22:39:16 -04:00
use App\Models\Node;
use App\Models\Server;
use App\Models\Database;
use App\Tests\Integration\IntegrationTestCase;
use App\Services\Deployment\FindViableNodesService;
class FindViableNodesServiceTest extends IntegrationTestCase
{
2024-03-19 21:09:16 -04:00
protected function setUp(): void
{
parent::setUp();
Database::query()->delete();
Server::query()->delete();
Node::query()->delete();
}
2024-03-19 21:12:27 -04:00
public function testExceptionIsThrownIfNoDiskSpaceHasBeenSet(): void
{
2023-02-23 12:30:16 -07:00
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Disk space must be an int, got NULL');
$this->getService()->handle();
}
2024-03-19 21:12:27 -04:00
public function testExceptionIsThrownIfNoMemoryHasBeenSet(): void
{
2023-02-23 12:30:16 -07:00
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Memory usage must be an int, got NULL');
$this->getService()->setDisk(10)->handle();
}
private function getService(): FindViableNodesService
{
return $this->app->make(FindViableNodesService::class);
}
}