Transitioned from obsolete gateway object classes (`edge_gateway_shell_action_jobs_o`, `edge_gateway_shell_events_o`, `edge_gateway_shell_sessions_o`, `edge_gateway_update_jobs_o`) to the new agent implementation (`edge-gateway-agent/agent.php`).
25 lines
1.4 KiB
PHP
25 lines
1.4 KiB
PHP
<?php
|
|
|
|
it('caches the paginated order-bookings list response and invalidates it on booking changes', function (): void {
|
|
$routeFile = app_path('routes/orderBookingRoute.php');
|
|
$objectFile = app_path('objects/order_bookings_o.php');
|
|
|
|
expect(is_file($routeFile))->toBeTrue();
|
|
expect(is_file($objectFile))->toBeTrue();
|
|
|
|
$routeCode = preg_replace('/\s+/', ' ', (string)file_get_contents($routeFile));
|
|
$objectCode = preg_replace('/\s+/', ' ', (string)file_get_contents($objectFile));
|
|
|
|
expect($routeCode)->toContain('use classes\order_bookings_list_cache;');
|
|
expect($routeCode)->toContain('$cacheTtl = order_bookings_list_cache::getTtl();');
|
|
expect($routeCode)->toContain('$cacheKey = $cacheTtl > 0 ? $this->getOrderBookingsListCacheKey($object, $forcedFilters) : null;');
|
|
expect($routeCode)->toContain('$cachedPayload = order_bookings_list_cache::getPayload($cacheKey);');
|
|
expect($routeCode)->toContain('$response->rawJson($cachedPayload);');
|
|
expect($routeCode)->toContain('order_bookings_list_cache::storePayload($cacheKey, $payload, $cacheTtl);');
|
|
expect($routeCode)->toContain('$response->rawJson($payload);');
|
|
expect($routeCode)->toContain('private function getOrderBookingsListCacheKey(order_bookings_o $object, string $forcedFilters): string');
|
|
|
|
expect($objectCode)->toContain('use classes\order_bookings_list_cache;');
|
|
expect($objectCode)->toContain('order_bookings_list_cache::clearAll();');
|
|
});
|