31 lines
1.3 KiB
PHP
31 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace app\common\service\followupaudio {
|
|
final class FollowupAudioStore {
|
|
public static bool $fail = false;
|
|
public static int $errors = 0;
|
|
public static function cleanupExpired(): array {
|
|
if (self::$fail) { throw new \RuntimeException('private-patient-path'); }
|
|
return ['tasks_purged' => 2, 'uploads_deleted' => 2, 'active_skipped' => 1, 'errors' => self::$errors,
|
|
'private_path' => '/private/patient-do-not-print'];
|
|
}
|
|
}
|
|
}
|
|
namespace {
|
|
require dirname(__DIR__) . '/vendor/autoload.php';
|
|
use app\common\service\followupaudio\FollowupAudioStore as Store;
|
|
use app\command\FollowupAudioCleanup as Cleanup;
|
|
$checks = 0;
|
|
foreach ([[false, 0, 0], [false, 1, 1], [true, 0, 1]] as [$fail, $errors, $expected]) {
|
|
Store::$fail = $fail; Store::$errors = $errors;
|
|
$output = new \think\console\Output('buffer');
|
|
$code = (new Cleanup())->run(new \think\console\Input([]), $output);
|
|
$text = $output->fetch();
|
|
if ($code !== $expected || str_contains($text, 'private')) { throw new \RuntimeException('Cleanup exit/redaction mismatch'); }
|
|
$checks += 2;
|
|
}
|
|
echo 'FOLLOWUP_AUDIO_CLEANUP_COMMAND assertions=' . $checks . ' PASS errors_nonzero=1 no_sensitive_output=1' . PHP_EOL;
|
|
}
|