31 lines
937 B
PHP
31 lines
937 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Tests\Unit;
|
|
|
|
use App\Config\ConfigLoader;
|
|
use App\Config\ConfigValidator;
|
|
use App\Module\Blueprints\Service\BlueprintService;
|
|
use App\Module\BuildQueue\Service\BuildQueueService;
|
|
use App\Shared\Clock\FixedTimeProvider;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class QueueSlotsTest extends TestCase
|
|
{
|
|
public function testQueueSlotsGrowWithBuildCenter(): void
|
|
{
|
|
$pdo = new \PDO('sqlite::memory:');
|
|
$loader = new ConfigLoader(new ConfigValidator(), dirname(__DIR__, 3) . '/config');
|
|
$blueprints = new BlueprintService($loader);
|
|
$service = new BuildQueueService($pdo, $blueprints, new FixedTimeProvider(new \DateTimeImmutable('2026-02-03 00:00:00')));
|
|
|
|
$buildings = [
|
|
'build_center' => ['count' => 2, 'level' => 0],
|
|
];
|
|
|
|
$slots = $service->calculateQueueSlots($buildings, 0);
|
|
self::assertSame(2, $slots);
|
|
}
|
|
}
|