27 lines
1.2 KiB
PHP
27 lines
1.2 KiB
PHP
<?php
|
|
|
|
it('wires GET /orders through batched enrichment and stripe snapshot caching', function (): void {
|
|
$routeFile = app_path('routes/ordersRoute.php');
|
|
$content = file_get_contents($routeFile);
|
|
|
|
expect($content)->not->toBeFalse();
|
|
|
|
$start = strpos($content, "\$this->get('/orders'");
|
|
$end = strpos($content, "\$this->post('/orders'");
|
|
expect($start)->not->toBeFalse();
|
|
expect($end)->not->toBeFalse();
|
|
|
|
$ordersGetSection = substr($content, (int)$start, (int)$end - (int)$start);
|
|
|
|
expect($ordersGetSection)->toContain('$rawOrders = $orders->listObjectsWithPaginationIfSet(');
|
|
expect($ordersGetSection)->toContain('$this->enrichOrderListRows($rawOrders)');
|
|
expect($ordersGetSection)->not->toContain('$order_obj->select((int)$order[\'id\'])');
|
|
expect($ordersGetSection)->not->toContain('$collected_order_invoices_obj->select((int)$order[\'invoice_collection_id\'])');
|
|
|
|
expect($content)->toContain('getNetAmountForOrders($orderIds)');
|
|
expect($content)->toContain('ensureRowsForOrderIds($orderIds)');
|
|
expect($content)->toContain("listMany('orders', \$orderIds)");
|
|
expect($content)->toContain('orders_stripe_invoice_snapshot_');
|
|
expect($content)->toContain('redis->expire($cacheKey, 30);');
|
|
});
|