Files
michaelschiemer/tests/debug/test-notification-center-component.php
Michael Schiemer fc3d7e6357 feat(Production): Complete production deployment infrastructure
- Add comprehensive health check system with multiple endpoints
- Add Prometheus metrics endpoint
- Add production logging configurations (5 strategies)
- Add complete deployment documentation suite:
  * QUICKSTART.md - 30-minute deployment guide
  * DEPLOYMENT_CHECKLIST.md - Printable verification checklist
  * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle
  * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference
  * production-logging.md - Logging configuration guide
  * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation
  * README.md - Navigation hub
  * DEPLOYMENT_SUMMARY.md - Executive summary
- Add deployment scripts and automation
- Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment
- Update README with production-ready features

All production infrastructure is now complete and ready for deployment.
2025-10-25 19:18:37 +02:00

113 lines
4.2 KiB
PHP

#!/usr/bin/env php
<?php
declare(strict_types=1);
require __DIR__ . '/../../vendor/autoload.php';
use App\Application\LiveComponents\NotificationCenterComponent;
echo "Testing NotificationCenterComponent Migration\n";
echo "=======================================\n\n";
try {
$component = new NotificationCenterComponent(
id: 'notification-center-test',
initialData: [
'notifications' => [
[
'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);
}