Files
XC_VM/tests/Unit/FfmpegPathsTest.php
T
Divarion-D 62d2d1d942 chore(psr4): phase 3 — namespace Streaming layer
Namespace all 17 Streaming classes into XcVm\Streaming\<Subdir> (Auth, Balancer,
Codec, Delivery, Health, Lifecycle, Protection + root AsyncFileOperations,
StreamingBootstrap, TS).

- Add namespace to every class; add use to referrers across src/ and tests/;
  convert leading-backslash refs from earlier commits (\FfmpegPaths,
  \FFprobeRunner, \ProcessChecker, \StreamingBootstrap) to FQCNs.
- Qualify built-ins/ioncube inside Streaming (\DateTime, \DateTimeZone,
  \Exception, \XC_VM).
- FfmpegPathsTest: new ReflectionClass('FfmpegPaths') string → ::class FQCN.
- phpstan-baseline.neon regenerated (291).

Verified: php -l clean; PHPStan no errors; PHPUnit 295/295; no mangled FQCNs;
leading-backslash re-sweep clean.
2026-06-25 18:55:35 +03:00

37 lines
1.1 KiB
PHP

<?php
use XcVm\Streaming\Codec\FfmpegPaths;
use PHPUnit\Framework\TestCase;
final class FfmpegPathsTest extends TestCase {
protected function setUp(): void {
$this->resetFfmpegPaths();
}
public function testResolveUsesExpectedBinariesForKnownVersion() {
FfmpegPaths::resolve('8.0');
$this->assertSame(FFMPEG_BIN_80, FfmpegPaths::cpu());
$this->assertSame(FFMPEG_BIN_80, FfmpegPaths::gpu());
$this->assertSame(FFPROBE_BIN_80, FfmpegPaths::probe());
}
public function testResolveFallsBackToLegacyVersion() {
FfmpegPaths::resolve('unknown');
$this->assertSame(FFMPEG_BIN_40, FfmpegPaths::cpu());
$this->assertSame(FFMPEG_BIN_40, FfmpegPaths::gpu());
$this->assertSame(FFPROBE_BIN_40, FfmpegPaths::probe());
}
private function resetFfmpegPaths() {
$reflection = new ReflectionClass(FfmpegPaths::class);
foreach (array('cpu', 'gpu', 'probe') as $propertyName) {
$property = $reflection->getProperty($propertyName);
$property->setAccessible(true);
$property->setValue(null, null);
}
$resolved = $reflection->getProperty('resolved');
$resolved->setAccessible(true);
$resolved->setValue(null, false);
}
}