- 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.
90 lines
3.5 KiB
PHP
90 lines
3.5 KiB
PHP
#!/usr/bin/env php
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
use App\Application\LiveComponents\DataTableComponent;
|
|
|
|
echo "Testing DataTableComponent Migration\n";
|
|
echo "=====================================\n\n";
|
|
|
|
try {
|
|
$component = new DataTableComponent(
|
|
id: 'datatable-test',
|
|
initialData: []
|
|
);
|
|
|
|
echo "✓ DataTableComponent created successfully\n";
|
|
echo " - ID: " . $component->getId() . "\n\n";
|
|
|
|
// Test sort() method
|
|
echo "Testing sort() method...\n";
|
|
$result = $component->sort('name', 'asc');
|
|
echo " ✓ sort() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Sort column: " . $result['sort']['column'] . "\n";
|
|
echo " - Sort direction: " . $result['sort']['direction'] . "\n";
|
|
echo " - Rows count: " . count($result['rows']) . "\n";
|
|
echo " - Keys: " . implode(', ', array_keys($result)) . "\n\n";
|
|
|
|
// Test changePage() method
|
|
echo "Testing changePage() method...\n";
|
|
$result = $component->changePage(2);
|
|
echo " ✓ changePage() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Current page: " . $result['page'] . "\n";
|
|
echo " - Total pages: " . $result['total_pages'] . "\n\n";
|
|
|
|
// Test changePageSize() method
|
|
echo "Testing changePageSize() method...\n";
|
|
$result = $component->changePageSize(25);
|
|
echo " ✓ changePageSize() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Page size: " . $result['page_size'] . "\n";
|
|
echo " - Rows in page: " . count($result['rows']) . "\n\n";
|
|
|
|
// Test toggleRow() method
|
|
echo "Testing toggleRow() method...\n";
|
|
$result = $component->toggleRow(1);
|
|
echo " ✓ toggleRow() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Selected rows: " . implode(', ', $result['selected_rows']) . "\n\n";
|
|
|
|
// Test selectAll() method
|
|
echo "Testing selectAll() method...\n";
|
|
$result = $component->selectAll();
|
|
echo " ✓ selectAll() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Selected rows count: " . count($result['selected_rows']) . "\n\n";
|
|
|
|
// Test deselectAll() method
|
|
echo "Testing deselectAll() method...\n";
|
|
$result = $component->deselectAll();
|
|
echo " ✓ deselectAll() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Selected rows count: " . count($result['selected_rows']) . "\n\n";
|
|
|
|
// Test filter() method
|
|
echo "Testing filter() method...\n";
|
|
$result = $component->filter('name', 'John');
|
|
echo " ✓ filter() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Filtered rows: " . $result['total_rows'] . "\n";
|
|
echo " - Filter value: " . $result['filters']['name'] . "\n\n";
|
|
|
|
// Test bulkDelete() method
|
|
$component2 = new DataTableComponent(
|
|
id: 'datatable-test-2',
|
|
initialData: ['selected_rows' => [1, 2, 3]]
|
|
);
|
|
|
|
echo "Testing bulkDelete() method...\n";
|
|
$result = $component2->bulkDelete();
|
|
echo " ✓ bulkDelete() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Message: " . ($result['message'] ?? 'none') . "\n";
|
|
echo " - Selected rows after: " . count($result['selected_rows']) . "\n\n";
|
|
|
|
echo "=====================================\n";
|
|
echo "✅ All DataTableComponent tests passed!\n";
|
|
|
|
} catch (\Throwable $e) {
|
|
echo "❌ Error: " . $e->getMessage() . "\n";
|
|
echo " File: " . $e->getFile() . ":" . $e->getLine() . "\n";
|
|
exit(1);
|
|
}
|