Files
api/services/nginx/app/tests/Unit/Invoicing/EconomicTransferQueueSchemaBootstrapTest.php
T
Jeppe Bundgaard 6d4066be1c Add unit tests for InvoicingPeriodDraftOverlay and reference suggestion logic, including fake DB integration and aggregation methods
- Implemented `InvoicingPeriodDraftOverlayTest` with coverage for blocking and permitting invoicing actions based on draft states, transactions, and metadata.
- Created `ReferenceSuggestionsApiTest` to validate ranked and filtered suggestions across bookings, orders, and vehicles with varied match relevance, context, and frequency.
- Added `order_reference_suggestions_service` class, including query methods, normalization utilities, and aggregation logic for reference suggestions.
- Enhanced query handling in `InvoicingPeriodDraftOverlayFakeDb` to validate SQL constraints and column cache resets in overlapping invoicing contexts.
2026-05-11 18:18:08 +02:00

33 lines
1.8 KiB
PHP

<?php
it('defines economic transfer queue jobs schema bootstrap table and tracking columns', function (): void {
$content = file_get_contents(app_path('classes/economic_transfer_queue_schema_bootstrap.php'));
expect($content)->not->toBeFalse();
expect($content)->toContain('CREATE TABLE IF NOT EXISTS economic_transfer_queue_jobs');
expect($content)->toContain("status VARCHAR(32) NOT NULL DEFAULT 'QUEUED'");
expect($content)->toContain('progress_percent TINYINT UNSIGNED NOT NULL DEFAULT 0');
expect($content)->toContain('error_message TEXT NULL');
expect($content)->toContain('payload_json JSON NOT NULL');
expect($content)->toContain('result_json JSON NULL');
expect($content)->toContain('CREATE TABLE IF NOT EXISTS economic_transfer_queue_job_dismissals');
expect($content)->toContain('queue_job_id BIGINT UNSIGNED NOT NULL');
expect($content)->toContain('user_id INT NOT NULL');
expect($content)->toContain('dismissed_status VARCHAR(32) NOT NULL');
expect($content)->toContain('PRIMARY KEY (queue_job_id, user_id)');
});
it('provides queue processor class constants and processing entrypoint', function (): void {
$content = file_get_contents(app_path('classes/economic_transfer_queue.php'));
expect($content)->not->toBeFalse();
expect($content)->toContain('public const STATUS_QUEUED');
expect($content)->toContain('public const STATUS_PROCESSING');
expect($content)->toContain('public const STATUS_COMPLETED');
expect($content)->toContain('public const STATUS_FAILED');
expect($content)->toContain('public const TYPE_ORDER_DRAFT_EXPORT');
expect($content)->toContain('public const TYPE_ORDER_INVOICE_EXPORT');
expect($content)->toContain('public const TYPE_COLLECTED_INVOICE_EXPORT');
expect($content)->toContain('public function processPending(int $limit = 5): array');
});