TenantAtlas/apps/platform/app/Services/TenantConfiguration/FakeExchangePowerShellProcessExecutor.php
Ahmed Darrazi 90a411429e
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 1m23s
feat: add Exchange PowerShell production runner gate
2026-07-07 20:32:36 +02:00

47 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Services\TenantConfiguration;
final class FakeExchangePowerShellProcessExecutor implements ExchangePowerShellProcessExecutor
{
/**
* @var list<array{arguments: list<string>, timeout_seconds: int}>
*/
public array $calls = [];
/**
* @param list<ExchangePowerShellProcessResult> $results
*/
public function __construct(
private bool $available = true,
private array $results = [],
) {}
public function setAvailable(bool $available): void
{
$this->available = $available;
}
public function pushResult(ExchangePowerShellProcessResult $result): void
{
$this->results[] = $result;
}
public function available(): bool
{
return $this->available;
}
public function run(ExchangePowerShellProcessCommand $command): ExchangePowerShellProcessResult
{
$this->calls[] = [
'arguments' => $command->arguments,
'timeout_seconds' => $command->timeoutSeconds,
];
return array_shift($this->results) ?? ExchangePowerShellProcessResult::completed(0, '[]');
}
}