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

89 lines
3.4 KiB
PHP

#!/usr/bin/env php
<?php
declare(strict_types=1);
require __DIR__ . '/../../vendor/autoload.php';
use App\Application\LiveComponents\TabsComponent;
echo "Testing TabsComponent Migration\n";
echo "=======================================\n\n";
try {
$component = new TabsComponent(
id: 'tabs-test',
initialData: [
'tabs' => [
['id' => 'tab1', 'title' => 'Tab 1', 'content' => 'Content 1', 'closable' => true],
['id' => 'tab2', 'title' => 'Tab 2', 'content' => 'Content 2', 'closable' => true],
],
'active_tab' => 'tab1',
'max_tabs' => 10,
'allow_close' => true,
'allow_add' => true,
]
);
echo "✓ TabsComponent created successfully\n";
echo " - ID: " . $component->getId() . "\n\n";
// Test switchTab() method
echo "Testing switchTab() method...\n";
$result = $component->switchTab('tab2');
echo " ✓ switchTab() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
echo " - Active tab: " . $result['active_tab'] . "\n";
echo " - Keys: " . implode(', ', array_keys($result)) . "\n\n";
// Test addTab() method
echo "Testing addTab() method...\n";
$result = $component->addTab('New Tab', 'New content');
echo " ✓ addTab() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
echo " - Tab count: " . count($result['tabs']) . "\n";
echo " - New active tab: " . $result['active_tab'] . "\n\n";
// Test closeTab() method
$component2 = new TabsComponent(
id: 'tabs-test-2',
initialData: [
'tabs' => [
['id' => 'tab1', 'title' => 'Tab 1', 'content' => 'Content 1', 'closable' => true],
['id' => 'tab2', 'title' => 'Tab 2', 'content' => 'Content 2', 'closable' => true],
],
'active_tab' => 'tab1',
]
);
echo "Testing closeTab() method...\n";
$result = $component2->closeTab('tab1');
echo " ✓ closeTab() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
echo " - Tab count: " . count($result['tabs']) . "\n";
echo " - Active tab after close: " . $result['active_tab'] . "\n\n";
// Test updateTabContent() method
echo "Testing updateTabContent() method...\n";
$result = $component->updateTabContent('tab1', 'Updated content');
echo " ✓ updateTabContent() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
echo " - Updated: " . ($result['tabs'][0]['updated_at'] !== null ? 'YES' : 'NO') . "\n\n";
// Test updateTabTitle() method
echo "Testing updateTabTitle() method...\n";
$result = $component->updateTabTitle('tab1', 'Updated Title');
echo " ✓ updateTabTitle() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
echo " - New title: " . $result['tabs'][0]['title'] . "\n\n";
// Test reorderTabs() method
echo "Testing reorderTabs() method...\n";
$result = $component->reorderTabs(['tab2', 'tab1']);
echo " ✓ reorderTabs() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
echo " - First tab ID: " . $result['tabs'][0]['id'] . "\n\n";
echo "=======================================\n";
echo "✅ All TabsComponent tests passed!\n";
} catch (\Throwable $e) {
echo "❌ Error: " . $e->getMessage() . "\n";
echo " File: " . $e->getFile() . ":" . $e->getLine() . "\n";
exit(1);
}