Files
michaelschiemer/tests/debug/test-datatable-livecomponent-fixed.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

162 lines
5.0 KiB
PHP

<?php
declare(strict_types=1);
echo "=== Testing DataTable LiveComponent (Fixed Version) ===\n\n";
// 1. Test page load
echo "1. Testing page load...\n";
$ch = curl_init('http://nginx/livecomponent-datatable');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
'Host: localhost',
]);
$html = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpCode !== 200) {
echo "❌ FAILED: HTTP $httpCode\n";
exit(1);
}
echo "✅ Page loads successfully (HTTP 200)\n\n";
// 2. Check filter input placeholders are replaced
echo "2. Checking filter input placeholders...\n";
$unreplacedPlaceholders = [];
if (str_contains($html, '{{filters.id}}')) {
$unreplacedPlaceholders[] = '{{filters.id}}';
}
if (str_contains($html, '{{filters.name}}')) {
$unreplacedPlaceholders[] = '{{filters.name}}';
}
if (str_contains($html, '{{filters.email}}')) {
$unreplacedPlaceholders[] = '{{filters.email}}';
}
if (str_contains($html, '{{filters.role')) {
$unreplacedPlaceholders[] = '{{filters.role}}';
}
if (str_contains($html, '{{filters.status')) {
$unreplacedPlaceholders[] = '{{filters.status}}';
}
if (! empty($unreplacedPlaceholders)) {
echo "❌ FAILED: Unreplaced placeholders found:\n";
foreach ($unreplacedPlaceholders as $placeholder) {
echo " - $placeholder\n";
}
exit(1);
}
echo "✅ All filter placeholders replaced\n\n";
// 3. Verify filter inputs have value="" attribute
echo "3. Verifying filter inputs...\n";
if (! preg_match('/<input[^>]*name="filter_id"[^>]*value=""/', $html)) {
echo "❌ FAILED: filter_id doesn't have value=\"\" attribute\n";
exit(1);
}
if (! preg_match('/<input[^>]*name="filter_name"[^>]*value=""/', $html)) {
echo "❌ FAILED: filter_name doesn't have value=\"\" attribute\n";
exit(1);
}
if (! preg_match('/<input[^>]*name="filter_email"[^>]*value=""/', $html)) {
echo "❌ FAILED: filter_email doesn't have value=\"\" attribute\n";
exit(1);
}
echo "✅ All filter inputs have value=\"\" attribute\n\n";
// 4. Check select options are properly rendered
echo "4. Checking select options...\n";
if (! preg_match('/<select[^>]*name="filter_role"[^>]*>.*?<option value="Admin">Admin<\/option>/s', $html)) {
echo "❌ FAILED: Role select doesn't have Admin option\n";
exit(1);
}
if (! preg_match('/<select[^>]*name="filter_status"[^>]*>.*?<option value="Active">Active<\/option>/s', $html)) {
echo "❌ FAILED: Status select doesn't have Active option\n";
exit(1);
}
echo "✅ Select options properly rendered\n\n";
// 5. Check sort headers have class attributes
echo "5. Checking sort header classes...\n";
if (! preg_match('/<th[^>]*class="sortable sorted sorted-asc"[^>]*data-param-column="id"/', $html)) {
echo "❌ FAILED: ID column doesn't have sorted class\n";
exit(1);
}
if (! preg_match('/<th[^>]*class="sortable "[^>]*data-param-column="name"/', $html)) {
echo "❌ FAILED: Name column doesn't have empty sort class\n";
exit(1);
}
echo "✅ Sort header classes properly set\n\n";
// 6. Check pagination buttons have correct page values
echo "6. Checking pagination...\n";
// Current page is 1, so prevPage should be 1 (max(1, 1-1))
if (! preg_match('/<button[^>]*data-param-page="1"[^>]*>.*?← Zurück/s', $html)) {
echo "❌ FAILED: Previous button doesn't have correct page value\n";
exit(1);
}
// Current page is 1, total pages is 2, so nextPage should be 2 (min(2, 1+1))
if (! preg_match('/<button[^>]*data-param-page="2"[^>]*>.*?Weiter →/s', $html)) {
echo "❌ FAILED: Next button doesn't have correct page value\n";
exit(1);
}
echo "✅ Pagination values correct\n\n";
// 7. Verify component state is properly initialized
echo "7. Checking component state...\n";
if (! preg_match('/data-component-state="([^"]+)"/', $html, $matches)) {
echo "❌ FAILED: Component state attribute not found\n";
exit(1);
}
$stateJson = html_entity_decode($matches[1]);
$state = json_decode($stateJson, true);
if (! isset($state['data']['filters'])) {
echo "❌ FAILED: Filters not in component state\n";
exit(1);
}
$filters = $state['data']['filters'];
if ($filters['id'] !== '' || $filters['name'] !== '' || $filters['email'] !== '' ||
$filters['role'] !== '' || $filters['status'] !== '') {
echo "❌ FAILED: Filters not initialized with empty strings\n";
echo "Filters: " . json_encode($filters) . "\n";
exit(1);
}
echo "✅ Component state properly initialized with empty filter strings\n\n";
// Summary
echo "=== ALL TESTS PASSED ===\n\n";
echo "Summary:\n";
echo "✅ Page loads without errors\n";
echo "✅ All filter placeholders replaced\n";
echo "✅ Filter inputs have proper value attributes\n";
echo "✅ Select options rendered correctly\n";
echo "✅ Sort header classes properly applied\n";
echo "✅ Pagination values calculated correctly\n";
echo "✅ Component state initialized correctly\n";
echo "\nThe getFilters() fix successfully resolved all placeholder issues!\n";