- Introduced `selfserve_task_attachment_payloads` class for managing task attachments, including formatting and download URL generation. - Added unit and API tests to validate attachment handling in self-serve tasks and customer-scoped workflows. - Enhanced wash start simulation and studio graph projections to integrate task attachment data.
77 lines
2.1 KiB
PHP
77 lines
2.1 KiB
PHP
<?php
|
|
|
|
app_require('routes/moduleSelfServeRoute.php');
|
|
|
|
if (!class_exists(SelfserveInProgressWashAccessHarness::class)) {
|
|
class SelfserveInProgressWashAccessHarness extends \routes\moduleSelfServeRoute
|
|
{
|
|
public function __construct()
|
|
{
|
|
// Avoid route_t request initialization in this focused unit test.
|
|
}
|
|
|
|
public function scopeForCustomer(array $payload, ?int $customer_number): array
|
|
{
|
|
return $this->scopeInProgressWashResponseForCustomer($payload, $customer_number);
|
|
}
|
|
}
|
|
}
|
|
|
|
it('keeps own in-progress self-serve wash details visible to the customer', function (): void {
|
|
$route = new SelfserveInProgressWashAccessHarness();
|
|
|
|
$payload = [
|
|
'lane_id' => 7,
|
|
'in_progress' => true,
|
|
'session' => [
|
|
'id' => 704,
|
|
'customer_number' => 12345679,
|
|
'reg' => 'AB12345',
|
|
],
|
|
'customer' => [
|
|
'customer_number' => 12345679,
|
|
'display_name' => 'Example Customer',
|
|
],
|
|
'vehicle' => [
|
|
'id' => 55,
|
|
'reg' => 'AB12345',
|
|
],
|
|
];
|
|
|
|
expect($route->scopeForCustomer($payload, 12345679))->toBe($payload);
|
|
});
|
|
|
|
it('redacts another customers in-progress wash details during customer lane polling', function (): void {
|
|
$route = new SelfserveInProgressWashAccessHarness();
|
|
|
|
$scoped = $route->scopeForCustomer([
|
|
'lane_id' => 9,
|
|
'status' => 'MACHINE_STARTED',
|
|
'in_progress' => true,
|
|
'elapsed_minutes' => 4,
|
|
'session' => [
|
|
'id' => 804,
|
|
'customer_number' => 99999999,
|
|
'reg' => 'CD67890',
|
|
],
|
|
'customer' => [
|
|
'customer_number' => 99999999,
|
|
'display_name' => 'Other Customer',
|
|
'email' => 'other@example.test',
|
|
],
|
|
'vehicle' => [
|
|
'id' => 77,
|
|
'reg' => 'CD67890',
|
|
],
|
|
], 12345679);
|
|
|
|
expect($scoped)->toBe([
|
|
'lane_id' => 9,
|
|
'in_progress' => true,
|
|
'session' => null,
|
|
'customer' => null,
|
|
'vehicle' => null,
|
|
]);
|
|
});
|
|
|