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`).
24 lines
1.3 KiB
PHP
24 lines
1.3 KiB
PHP
<?php
|
|
|
|
it('adds a cached order-bookings counts endpoint 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_counts_cache;');
|
|
expect($routeCode)->toContain("\$this->get('/order-bookings/counts', function () {");
|
|
expect($routeCode)->toContain('$cacheTtl = order_bookings_counts_cache::getTtl();');
|
|
expect($routeCode)->toContain('$cacheKey = $cacheTtl > 0 ? $this->getOrderBookingsCountsCacheKey(');
|
|
expect($routeCode)->toContain('$cachedCounts = order_bookings_counts_cache::getCounts($cacheKey);');
|
|
expect($routeCode)->toContain('order_bookings_counts_cache::storeCounts($cacheKey, $counts, $cacheTtl);');
|
|
expect($routeCode)->toContain('getPendingBookingCounts(');
|
|
|
|
expect($objectCode)->toContain('use classes\order_bookings_counts_cache;');
|
|
expect($objectCode)->toContain('order_bookings_counts_cache::clearAll();');
|
|
});
|