Files
api/services/nginx/app/tests/Unit/Bookings/NonPosBookingCompletionRemovalTest.php
T
Jeppe B 2a6a86c9c3 Resolve backend Qodana critical and high findings (#314)
Resolve recommended-profile Critical and High findings, retain narrow analyzer exceptions, and update the edge-broker WebSocket dependency to a non-vulnerable release.
2026-07-17 05:44:16 +02:00

29 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 removes disabled generation and completion code', 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)->toBeFalse();
expect($downloadPosition)->toBeLessThan($disabledPosition);
expect($code)->not->toContain('new WashCertificateGenerator');
expect($code)->toContain('Booking completion must be completed through POS desktop or mobile steps.');
});