tick() === true && $order === ['maintenance', 'compensation'] && $maintenanceCalls === 1 && $compensationCalls === 1 && $service->observationErrors() === [], 'First notification pass was not bounded or did not report work.'); $order = []; $assert($service->tick() === true && $order === ['compensation', 'maintenance'] && $maintenanceCalls === 2 && $compensationCalls === 2, 'Notification channel priority did not alternate fairly.'); $order = []; $isolated = new CloudNotificationDeliveryService( static function () use (&$order): bool { $order[] = 'maintenance'; throw new RuntimeException('expected maintenance failure'); }, static function () use (&$order): bool { $order[] = 'compensation'; return true; } ); $assert($isolated->tick() === true && $order === ['maintenance', 'compensation'] && $isolated->observationErrors() === [ 'maintenance_notification_failed', ], 'A maintenance failure blocked compensation delivery or was hidden.'); $bothFailed = new CloudNotificationDeliveryService( static function (): bool { throw new RuntimeException('expected maintenance failure'); }, static function (): bool { throw new RuntimeException('expected compensation failure'); } ); $assert($bothFailed->tick() === false && $bothFailed->observationErrors() === [ 'maintenance_notification_failed', 'notification_failed', ], 'Multiple notification channel failures were not retained.'); echo "Cloud notification delivery service test passed.\n";