51 lines
1.8 KiB
PHP
51 lines
1.8 KiB
PHP
<?php
|
|
|
|
function system_search_openapi_content_or_skip(): string
|
|
{
|
|
$candidates = [];
|
|
for ($depth = 1; $depth <= 8; $depth++) {
|
|
$candidates[] = dirname(__DIR__, $depth) . DIRECTORY_SEPARATOR . 'openapi.yaml';
|
|
}
|
|
$cwd = getcwd();
|
|
if (is_string($cwd) && $cwd !== '') {
|
|
$candidates[] = $cwd . DIRECTORY_SEPARATOR . 'openapi.yaml';
|
|
$candidates[] = dirname($cwd) . DIRECTORY_SEPARATOR . 'openapi.yaml';
|
|
}
|
|
$candidates = array_values(array_unique($candidates));
|
|
|
|
foreach ($candidates as $candidate) {
|
|
if (is_file($candidate)) {
|
|
$content = file_get_contents($candidate);
|
|
if ($content !== false) {
|
|
return $content;
|
|
}
|
|
}
|
|
}
|
|
|
|
test()->markTestSkipped('openapi.yaml is not available in this runtime environment.');
|
|
}
|
|
|
|
it('documents system-wide search endpoints in openapi', function (): void {
|
|
$content = system_search_openapi_content_or_skip();
|
|
|
|
expect($content)->toContain('/search/system:');
|
|
expect($content)->toContain('/superuser/search/system/cache:');
|
|
expect($content)->toContain('/superuser/search/system/cache/rebuild:');
|
|
});
|
|
|
|
it('documents debug_intent and parser metadata schema in openapi', function (): void {
|
|
$content = system_search_openapi_content_or_skip();
|
|
|
|
expect($content)->toContain('debug_intent:');
|
|
expect($content)->toContain('SystemSearchIntentParserMeta:');
|
|
expect($content)->toContain('intent_parser:');
|
|
expect($content)->toContain('SystemSearchResponse:');
|
|
});
|
|
|
|
it('documents e-conomic indexed customer matching and synonym behavior', function (): void {
|
|
$content = system_search_openapi_content_or_skip();
|
|
|
|
expect($content)->toContain('local e-conomic customer index');
|
|
expect($content)->toContain('`rabat` -> `discount`');
|
|
});
|