27 lines
1.2 KiB
PHP
27 lines
1.2 KiB
PHP
<?php
|
|
|
|
it('resolves persisted booked invoices before probing for a draft', function (): void {
|
|
$content = file_get_contents(app_path('routes/orderInvoicesRoute.php'));
|
|
expect($content)->not->toBeFalse();
|
|
$content = (string)$content;
|
|
|
|
$persistedBookedPosition = strpos($content, '$persisted_booked_id = (int)$invoice->booked_invoice_id->value();');
|
|
$draftLookupPosition = strpos($content, '$draft_id = $invoice->getInvoiceDraftId();', (int)$persistedBookedPosition);
|
|
|
|
expect($persistedBookedPosition)->not->toBeFalse();
|
|
expect($draftLookupPosition)->not->toBeFalse();
|
|
expect($persistedBookedPosition)->toBeLessThan($draftLookupPosition);
|
|
expect($content)->toContain("'state' => \$economic_state");
|
|
expect($content)->toContain("'available_pdf_type' => \$available_pdf_type");
|
|
});
|
|
|
|
it('falls back from a missing draft to the booked pdf target', function (): void {
|
|
$content = file_get_contents(app_path('routes/orderInvoicesRoute.php'));
|
|
expect($content)->not->toBeFalse();
|
|
$content = (string)$content;
|
|
|
|
expect($content)->toContain("\$resolved_type = 'booked';");
|
|
expect($content)->toContain('$economic->invoices->pdf->getBooked($economic_invoice_id)');
|
|
expect($content)->toContain("'type' => \$resolved_type");
|
|
});
|