#!/usr/bin/env php [ [ 'id' => 'notif1', 'type' => 'info', 'title' => 'Test Notification', 'message' => 'This is a test', 'read' => false, 'timestamp' => time(), ], ], 'unread_count' => 1, 'filter' => 'all', 'show_panel' => false, ] ); echo "✓ NotificationCenterComponent created successfully\n"; echo " - ID: " . $component->getId() . "\n\n"; // Test markAsRead() method echo "Testing markAsRead() method...\n"; $result = $component->markAsRead('notif1'); echo " ✓ markAsRead() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n"; echo " - Unread count: " . $result['unread_count'] . "\n"; echo " - Keys: " . implode(', ', array_keys($result)) . "\n\n"; // Test markAsUnread() method echo "Testing markAsUnread() method...\n"; $result = $component->markAsUnread('notif1'); echo " ✓ markAsUnread() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n"; echo " - Unread count: " . $result['unread_count'] . "\n\n"; // Test deleteNotification() method echo "Testing deleteNotification() method...\n"; $result = $component->deleteNotification('notif1'); echo " ✓ deleteNotification() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n"; echo " - Notification count: " . count($result['notifications']) . "\n\n"; // Test markAllAsRead() method $component2 = new NotificationCenterComponent( id: 'notification-center-test-2', initialData: [ 'notifications' => [ ['id' => 'n1', 'read' => false], ['id' => 'n2', 'read' => false], ], ] ); echo "Testing markAllAsRead() method...\n"; $result = $component2->markAllAsRead(); echo " ✓ markAllAsRead() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n"; echo " - Unread count: " . $result['unread_count'] . "\n\n"; // Test deleteAllRead() method $component3 = new NotificationCenterComponent( id: 'notification-center-test-3', initialData: [ 'notifications' => [ ['id' => 'n1', 'read' => true], ['id' => 'n2', 'read' => false], ], ] ); echo "Testing deleteAllRead() method...\n"; $result = $component3->deleteAllRead(); echo " ✓ deleteAllRead() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n"; echo " - Notification count: " . count($result['notifications']) . "\n\n"; // Test filterByType() method echo "Testing filterByType() method...\n"; $result = $component->filterByType('error'); echo " ✓ filterByType() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n"; echo " - Filter: " . $result['filter'] . "\n\n"; // Test togglePanel() method echo "Testing togglePanel() method...\n"; $result = $component->togglePanel(); echo " ✓ togglePanel() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n"; echo " - Panel open: " . ($result['show_panel'] ? 'true' : 'false') . "\n\n"; // Test addNotification() method echo "Testing addNotification() method...\n"; $result = $component->addNotification('success', 'Success', 'Operation completed'); echo " ✓ addNotification() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n"; echo " - Panel auto-opened: " . ($result['show_panel'] ? 'true' : 'false') . "\n\n"; echo "=======================================\n"; echo "✅ All NotificationCenterComponent tests passed!\n"; } catch (\Throwable $e) { echo "❌ Error: " . $e->getMessage() . "\n"; echo " File: " . $e->getFile() . ":" . $e->getLine() . "\n"; exit(1); }