50 lines
2.2 KiB
PHP
50 lines
2.2 KiB
PHP
<?php
|
|
|
|
function department_daily_reports_complaints_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 complaints CRUD and customer lookup endpoints in openapi', function (): void {
|
|
$content = department_daily_reports_complaints_openapi_content_or_skip();
|
|
|
|
expect($content)->toContain('/departments/daily-reports/complaints:');
|
|
expect($content)->toContain('/departments/daily-reports/complaints/customers:');
|
|
expect($content)->toContain('operationId: listDailyReportComplaints');
|
|
expect($content)->toContain('operationId: searchDailyReportComplaintCustomers');
|
|
expect($content)->toContain('operationId: createDailyReportComplaint');
|
|
expect($content)->toContain('operationId: updateDailyReportComplaint');
|
|
expect($content)->toContain('operationId: deleteDailyReportComplaint');
|
|
expect($content)->toContain('DepartmentDailyReportComplaintCreateRequest:');
|
|
expect($content)->toContain('DepartmentDailyReportComplaintUpdateRequest:');
|
|
expect($content)->toContain('DepartmentDailyReportComplaint:');
|
|
expect($content)->toContain('DepartmentDailyReportComplaintCustomerSearchResult:');
|
|
expect($content)->toContain('DepartmentDailyReportComplaintCustomerSearchResponse:');
|
|
expect($content)->toContain('DepartmentDailyReportComplaintCollectionResponse:');
|
|
expect($content)->toContain('DepartmentDailyReportComplaintDeleteResponse:');
|
|
expect($content)->toContain('department_name:');
|
|
expect($content)->toContain('customer_number:');
|
|
});
|