Files
api/services/nginx/app/tests/Unit/Invoicing/InvoicingPeriodBackendOpenApiTest.php
T
Jeppe B 068f9e254f Complete selected-customer invoice period tree (#338)
Add the authoritative revision-bound invoice collection tree and guarded cleanup, merge, price-reset, and transfer operations.
2026-08-03 12:02:34 +02:00

63 lines
2.9 KiB
PHP

<?php
it('documents period invoice states and authenticated attachment content', function (): void {
$openApiFiles = [app_path('openapi.yaml')];
$rootOpenApiFile = dirname(app_path(), 3) . '/openapi.yaml';
if (is_file($rootOpenApiFile)) {
$openApiFiles[] = $rootOpenApiFile;
}
foreach ($openApiFiles as $openApiFile) {
expect($openApiFile)->toBeFile();
$content = file_get_contents($openApiFile);
expect($content)->not->toBeFalse();
$content = (string)$content;
expect($content)->toContain('/orders/attachments/content:');
expect($content)->toContain('OrderAttachmentDownloadLinkResponse:');
expect($content)->toContain('InvoicingPeriodResponseEnvelope:');
expect($content)->toContain('InvoicingPeriodInvoiceCollection:');
expect($content)->toContain('enum: [open, closed, economic_draft, economic_booked]');
expect($content)->toContain('available_pdf_type:');
expect($content)->toContain('enum: [draft, booked, none]');
}
});
it('documents the exception-first period review contract and workflow queries', function (): void {
$content = (string)file_get_contents(app_path('openapi.yaml'));
expect($content)
->toContain('- name: reviewState')
->toContain('- name: severity')
->toContain('- name: invoiceState')
->toContain('- name: departmentId')
->toContain('enum: [priority, customer_name, customer_number, total_amount]')
->toContain('InvoicingPeriodReview:')
->toContain('required: [state, severity, reasons, next_action, is_actionable, counts]')
->toContain('enum: [blocked, attention, queued, ready, completed]')
->toContain('InvoicingPeriodPagination:')
->toContain('required: [review_states, severities, invoice_states, department_ids]');
});
it('documents selected-customer object-tree snapshots and actor-bound bulk action fields', function (): void {
$content = (string)file_get_contents(app_path('openapi.yaml'));
expect($content)
->toContain('/superuser/invoicing/period/tree:')
->toContain('/superuser/invoicing/period/tree-actions/preview:')
->toContain('/superuser/invoicing/period/tree-actions/apply:')
->not->toContain('- name: includeTreeSnapshot')
->toContain('InvoicingPeriodTreeSnapshotEnvelope:')
->toContain('InvoicingPeriodTreeCapabilities:')
->toContain('InvoiceCollectionTreeActionPreviewEnvelope:')
->toContain('InvoiceCollectionTreeActionPreview:')
->toContain('off_period_impact:')
->toContain('date_from: {type: string, format: date}')
->toContain('complete_order_count')
->toContain('period_total_net_amount')
->toContain('snapshot_revision:')
->toContain('customer_number:')
->toContain('supplied action and selection still match the cached preview');
});