- Deleted `complete_booking_f` and `generate_booking_wash_certificate_f` classes. - Updated tests to ensure legacy booking completion routes are disabled. - Introduced tests for POST `/order-bookings/complete` to enforce POS-based booking completion management. - Added `/collected-invoices/split-by-month` route with API and unit tests for splitting collections into monthly periods. - Refactored impacted files to exclude legacy references and ensure continued compatibility with POS processes.
30 lines
1.4 KiB
PHP
30 lines
1.4 KiB
PHP
<?php
|
|
|
|
it('unregisters legacy booking completion forms', function (): void {
|
|
$formFile = app_path('classes/form.php');
|
|
$code = (string)file_get_contents($formFile);
|
|
|
|
expect(is_file(app_path('modules/forms/objects/complete_booking_f.php')))->toBeFalse();
|
|
expect(is_file(app_path('modules/forms/objects/generate_booking_wash_certificate_f.php')))->toBeFalse();
|
|
expect($code)->not->toContain('complete_booking_f');
|
|
expect($code)->not->toContain('generate_booking_wash_certificate_f');
|
|
expect($code)->not->toContain('COMPLETE_BOOKING_WITHOUT_WASH_CERTIFICATE');
|
|
expect($code)->not->toContain('GENERATE_BOOKING_WASH_CERTIFICATE');
|
|
});
|
|
|
|
it('keeps legacy wash certificate downloads but disables generation and completion', function (): void {
|
|
$code = (string)file_get_contents(app_path('modules/washcertificates/index.php'));
|
|
|
|
$downloadPosition = strpos($code, "isset(\$_GET['justDownload'])");
|
|
$disabledPosition = strpos($code, 'http_response_code(410)');
|
|
$completionPosition = strpos($code, "\$booking->status->set('completed')");
|
|
|
|
expect($downloadPosition)->not->toBeFalse();
|
|
expect($disabledPosition)->not->toBeFalse();
|
|
expect($completionPosition)->not->toBeFalse();
|
|
expect($downloadPosition)->toBeLessThan($disabledPosition);
|
|
expect($disabledPosition)->toBeLessThan($completionPosition);
|
|
expect($code)->toContain('Booking completion must be completed through POS desktop or mobile steps.');
|
|
});
|
|
|