mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-09-25 12:01:55 +02:00
- Core/Enum → XcVm\Core\Enum (BootContext, ModuleState, ServerEnvironment). - Core/Exception → XcVm\Core\Exception (XcVmException) + \Container (ContainerException, CircularDependencyException, ServiceCreationException) + \Module (ModuleException + the 4 module exceptions). The hierarchy resolves: XcVmException extends \RuntimeException; the Container/Module exceptions extend XcVmException via use; ContainerException keeps its PSR ContainerExceptionInterface. - Add use to referrers across src/ and tests/; fix the leading-backslash refs qualified in earlier hub commits (\ModuleState, \ServerEnvironment, \XcVmException, \ContainerException, \ModuleLoadException, ...) to their FQCNs. - phpstan-baseline.neon regenerated (292→292). Verified: php -l clean; PHPStan no errors (first pass); PHPUnit 295/295; leading-backslash re-sweep clean.
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
use XcVm\Core\Enum\ServerEnvironment;
|
|
use XcVm\Core\Enum\BootContext;
|
|
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());
|
|
}
|
|
}
|