Files
api/services/nginx/app/tests/Unit/Invoicing/EconomicDraftCustomerOpenApiSpecTest.php
T

41 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
function economic_draft_customer_openapi_specs_or_skip(): array
{
$root = dirname(__DIR__, 7);
$candidates = [
$root . DIRECTORY_SEPARATOR . 'backend-php' . DIRECTORY_SEPARATOR . 'services' . DIRECTORY_SEPARATOR . 'nginx' . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'openapi.yaml',
$root . DIRECTORY_SEPARATOR . 'backend-php' . DIRECTORY_SEPARATOR . 'openapi.yaml',
$root . DIRECTORY_SEPARATOR . 'front-end-vue' . DIRECTORY_SEPARATOR . 'openapi.yaml',
];
$specs = [];
foreach ($candidates as $candidate) {
if (!is_file($candidate)) {
test()->markTestSkipped('One or more tracked openapi.yaml copies are not available in this runtime environment.');
}
$content = file_get_contents($candidate);
if ($content === false) {
test()->markTestSkipped('Failed to read one or more tracked openapi.yaml copies.');
}
$specs[$candidate] = $content;
}
return $specs;
}
it('documents transaction draft customer config and auth runtime fields in all tracked openapi copies', function (): void {
foreach (economic_draft_customer_openapi_specs_or_skip() as $path => $content) {
expect($content, $path)->toContain('/auth/session:');
expect($content, $path)->toContain('transaction_draft_customer_number:');
expect($content, $path)->toContain('EconomicConfigEntry:');
expect($content, $path)->toContain('transactionDraftCustomerNumber');
expect($content, $path)->toContain('invoiceDiscountLayoutNumber');
expect($content, $path)->toContain('nullable: true');
}
});