2026-06-22 18:47:50 +03:00
|
|
|
<?php
|
|
|
|
|
|
2026-06-24 22:23:42 +03:00
|
|
|
use XcVm\Core\Enum\ServerEnvironment;
|
|
|
|
|
use XcVm\Core\Enum\BootContext;
|
2026-06-22 18:47:50 +03:00
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @covers BootContext
|
|
|
|
|
* @covers ServerEnvironment
|
|
|
|
|
*/
|
|
|
|
|
final class CoreEnumTest extends TestCase {
|
|
|
|
|
|
|
|
|
|
public function testBootContextValues() {
|
|
|
|
|
$this->assertSame('minimal', BootContext::Minimal->value);
|
|
|
|
|
$this->assertSame('cli', BootContext::Cli->value);
|
|
|
|
|
$this->assertSame('stream', BootContext::Stream->value);
|
|
|
|
|
$this->assertSame('admin', BootContext::Admin->value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testBootContextFromString() {
|
|
|
|
|
$this->assertSame(BootContext::Admin, BootContext::from('admin'));
|
|
|
|
|
$this->assertNull(BootContext::tryFrom('nope'));
|
|
|
|
|
$this->assertCount(4, BootContext::cases());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testServerEnvironmentValues() {
|
|
|
|
|
$this->assertSame('main', ServerEnvironment::Main->value);
|
|
|
|
|
$this->assertSame('lb', ServerEnvironment::LoadBalancer->value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testServerEnvironmentFromString() {
|
|
|
|
|
$this->assertSame(ServerEnvironment::LoadBalancer, ServerEnvironment::from('lb'));
|
|
|
|
|
$this->assertNull(ServerEnvironment::tryFrom('xxx'));
|
|
|
|
|
$this->assertCount(2, ServerEnvironment::cases());
|
|
|
|
|
}
|
|
|
|
|
}
|