Files
michaelschiemer/tests/debug/test-live-presence-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

103 lines
3.6 KiB
PHP

#!/usr/bin/env php
<?php
declare(strict_types=1);
require __DIR__ . '/../../vendor/autoload.php';
use App\Application\LiveComponents\LivePresenceComponent;
echo "Testing LivePresenceComponent Migration\n";
echo "=======================================\n\n";
try {
$component = new LivePresenceComponent(
id: 'live-presence-test',
initialData: [
'users' => [
[
'user_id' => 'user1',
'user_name' => 'John Doe',
'avatar_url' => null,
'status' => 'online',
'joined_at' => time(),
'last_seen' => time(),
],
],
'show_avatars' => true,
'show_names' => true,
'show_count' => true,
'max_visible_users' => 10,
'presence_timeout' => 300,
]
);
echo "✓ LivePresenceComponent created successfully\n";
echo " - ID: " . $component->getId() . "\n\n";
// Test userJoined() method
echo "Testing userJoined() method...\n";
$result = $component->userJoined('user2', 'Jane Doe', 'https://example.com/avatar.jpg');
echo " ✓ userJoined() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
echo " - User count: " . count($result['users']) . "\n";
echo " - Keys: " . implode(', ', array_keys($result)) . "\n\n";
// Test userLeft() method
echo "Testing userLeft() method...\n";
$result = $component->userLeft('user1');
echo " ✓ userLeft() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
echo " - User count: " . count($result['users']) . "\n\n";
// Test updateActivity() method
$component2 = new LivePresenceComponent(
id: 'live-presence-test-2',
initialData: [
'users' => [
[
'user_id' => 'user1',
'user_name' => 'John Doe',
'status' => 'away',
'last_seen' => time() - 100,
],
],
]
);
echo "Testing updateActivity() method...\n";
$result = $component2->updateActivity('user1');
echo " ✓ updateActivity() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
echo " - Status updated: " . ($result['users'][0]['status'] === 'online' ? 'YES' : 'NO') . "\n\n";
// Test updateStatus() method
echo "Testing updateStatus() method...\n";
$result = $component2->updateStatus('user1', 'busy');
echo " ✓ updateStatus() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
echo " - New status: " . $result['users'][0]['status'] . "\n\n";
// Test cleanupInactive() method
$component3 = new LivePresenceComponent(
id: 'live-presence-test-3',
initialData: [
'users' => [
['user_id' => 'active', 'last_seen' => time()],
['user_id' => 'inactive', 'last_seen' => time() - 500],
],
'presence_timeout' => 300,
]
);
echo "Testing cleanupInactive() method...\n";
$result = $component3->cleanupInactive();
echo " ✓ cleanupInactive() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
echo " - User count after cleanup: " . count($result['users']) . "\n";
echo " - Inactive users removed: " . (count($result['users']) === 1 ? 'YES' : 'NO') . "\n\n";
echo "=======================================\n";
echo "✅ All LivePresenceComponent tests passed!\n";
} catch (\Throwable $e) {
echo "❌ Error: " . $e->getMessage() . "\n";
echo " File: " . $e->getFile() . ":" . $e->getLine() . "\n";
exit(1);
}