Guard the wash subscription distribution query after invoice-inclusion filtering removes all candidate orders, preventing an empty IN () clause on the invoicing distribution endpoint. Verified with focused syntax, Pest, PHPStan, and invoicing unit-suite checks.
16 lines
634 B
PHP
16 lines
634 B
PHP
<?php
|
|
|
|
it('does not query subscription-applied transactions with an empty eligible order list', function (): void {
|
|
$content = file_get_contents(dirname(__DIR__, 3) . '/objects/customer_vehicles_o.php');
|
|
|
|
expect($content)->not->toBeFalse();
|
|
$content = (string)$content;
|
|
|
|
expect($content)
|
|
->toContain('$orders = [];')
|
|
->toMatch('/\$orders\[\] = \(int\)\$transaction_id;\s*}\s*if \(empty\(\$orders\)\) {\s*return \[\];\s*}\s*\$order_ids = implode/s')
|
|
->toContain('AND o.id IN ($order_ids)')
|
|
->not->toContain('rtrim($orders, \',\')')
|
|
->not->toContain('AND o.id IN ($orders)');
|
|
});
|