feat: M3 import & indexing engine delivery layer with durable collision handling, space checking and console
This commit is contained in:
1 parent
93d991703c
commit
9d277d9e72
48 files changed
+5147
-4
No files matched your search
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MeshVault\Tests\Unit\Console;
|
||||
|
||||
use MeshVault\Console\ConsoleServices;
|
||||
use Throwable;
|
||||
|
||||
final class FakeConsoleServices implements ConsoleServices
|
||||
{
|
||||
/** @var list<array{0: string, 1: list<string>}> */
|
||||
public array $imports = [];
|
||||
|
||||
public int $runs = 0;
|
||||
|
||||
/** @param list<int|null> $jobs */
|
||||
public function __construct(
|
||||
private readonly int $importResult = 1,
|
||||
private readonly ?Throwable $importError = null,
|
||||
private array $jobs = [],
|
||||
private readonly ?Throwable $workerError = null,
|
||||
) {
|
||||
}
|
||||
|
||||
public function import(string $sourcePath, array $extensions): int
|
||||
{
|
||||
$this->imports[] = [$sourcePath, $extensions];
|
||||
if ($this->importError !== null) {
|
||||
throw $this->importError;
|
||||
}
|
||||
return $this->importResult;
|
||||
}
|
||||
|
||||
public function runWorkerOnce(callable $shouldStop): ?int
|
||||
{
|
||||
$this->runs++;
|
||||
if ($this->workerError !== null) {
|
||||
throw $this->workerError;
|
||||
}
|
||||
// The real worker consults the callback between items; mirror that contract.
|
||||
$shouldStop();
|
||||
return array_shift($this->jobs);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user