48 lines
2.0 KiB
PHP
48 lines
2.0 KiB
PHP
<?php
|
|
|
|
function department_daily_reports_openapi_content_or_skip(): string
|
|
{
|
|
$candidates = [WD . '/openapi.yaml'];
|
|
for ($depth = 1; $depth <= 8; $depth++) {
|
|
$candidates[] = dirname(WD, $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';
|
|
}
|
|
|
|
foreach (array_values(array_unique($candidates)) as $candidate) {
|
|
if (!is_file($candidate)) {
|
|
continue;
|
|
}
|
|
|
|
$content = file_get_contents($candidate);
|
|
if ($content !== false) {
|
|
return $content;
|
|
}
|
|
}
|
|
|
|
test()->markTestSkipped('openapi.yaml is not mounted in this test container.');
|
|
}
|
|
|
|
it('documents the daily report overview endpoint and reusable schemas in openapi', function (): void {
|
|
$content = department_daily_reports_openapi_content_or_skip();
|
|
|
|
expect($content)->toContain('/departments/daily-reports/overview:');
|
|
expect($content)->toContain('/departments/daily-reports/product-targets:');
|
|
expect($content)->toContain('/superuser/departments/{id}/overview:');
|
|
expect($content)->toContain('operationId: getDailyReportOverview');
|
|
expect($content)->toContain('operationId: setDailyReportProductTarget');
|
|
expect($content)->toContain('operationId: getSuperuserDepartmentOverview');
|
|
expect($content)->toContain('DepartmentDailyReportOverviewResponse:');
|
|
expect($content)->toContain('DepartmentDailyReportProductTargetRequest:');
|
|
expect($content)->toContain('set_department_daily_report_product_targets');
|
|
expect($content)->toContain('target_percentage');
|
|
expect($content)->toContain('SuperuserDepartmentOverviewResponse:');
|
|
expect($content)->toContain('DepartmentDailyReportMetric:');
|
|
expect($content)->toContain('DepartmentDailyReportProductTile:');
|
|
expect($content)->toContain('- name: department_ids');
|
|
});
|