Files
michaelschiemer/tests/debug/test-full-template-pipeline.php
Michael Schiemer c8b47e647d feat(Docker): Upgrade to PHP 8.5.0RC3 with native ext-uri support
BREAKING CHANGE: Requires PHP 8.5.0RC3

Changes:
- Update Docker base image from php:8.4-fpm to php:8.5.0RC3-fpm
- Enable ext-uri for native WHATWG URL parsing support
- Update composer.json PHP requirement from ^8.4 to ^8.5
- Add ext-uri as required extension in composer.json
- Move URL classes from Url.php85/ to Url/ directory (now compatible)
- Remove temporary PHP 8.4 compatibility workarounds

Benefits:
- Native URL parsing with Uri\WhatWg\Url class
- Better performance for URL operations
- Future-proof with latest PHP features
- Eliminates PHP version compatibility issues
2025-10-27 09:31:28 +01:00

107 lines
3.0 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/../../vendor/autoload.php';
use App\Framework\DI\DefaultContainer;
use App\Framework\View\ViewRenderer;
use App\Framework\View\RenderContext;
use App\Framework\Meta\MetaData;
// Initialize container
$container = new DefaultContainer();
// Get ViewRenderer (complete pipeline)
$viewRenderer = $container->get(ViewRenderer::class);
// Test data matching the ML Dashboard
$data = [
'models' => [
[
'model_name' => 'fraud-detector',
'version' => '1.0.0',
'type' => 'supervised',
'accuracy' => 0.94,
'status' => 'healthy',
'total_predictions' => 1234
],
[
'model_name' => 'spam-classifier',
'version' => '2.0.0',
'type' => 'supervised',
'accuracy' => 0.78,
'status' => 'degraded',
'total_predictions' => 567
],
],
'alerts' => [],
'summary' => [
'total_models' => 2,
'healthy_models' => 1,
'degraded_models' => 1
]
];
// Create render context
$context = new RenderContext(
template: 'admin/ml-dashboard',
metaData: new MetaData('ML Dashboard', ''),
data: $data,
controllerClass: null
);
echo "=== TESTING FULL TEMPLATE PIPELINE ===\n\n";
echo "Data being passed:\n";
print_r($data);
echo "\n";
try {
echo "=== RENDERING TEMPLATE ===\n";
$html = $viewRenderer->render($context);
echo "=== CHECKING FOR FOREACH ATTRIBUTES IN OUTPUT ===\n";
if (str_contains($html, 'foreach=')) {
echo "❌ PROBLEM: foreach attribute found in output (not processed)\n";
// Show the problematic section
preg_match('/<tr[^>]*foreach[^>]*>.*?<\/tr>/s', $html, $matches);
if (!empty($matches)) {
echo "Found:\n" . $matches[0] . "\n\n";
}
} else {
echo "✅ Good: No foreach attributes in output\n\n";
}
echo "=== CHECKING FOR PLACEHOLDERS IN OUTPUT ===\n";
if (preg_match('/{{[^}]+}}/', $html, $matches)) {
echo "❌ PROBLEM: Unreplaced placeholders found\n";
echo "Example: " . $matches[0] . "\n\n";
} else {
echo "✅ Good: No unreplaced placeholders\n\n";
}
echo "=== CHECKING FOR MODEL DATA IN OUTPUT ===\n";
if (str_contains($html, 'fraud-detector')) {
echo "✅ Good: Model data found in output\n";
} else {
echo "❌ PROBLEM: Model data NOT found in output\n";
}
if (str_contains($html, '1.0.0')) {
echo "✅ Good: Version data found in output\n";
} else {
echo "❌ PROBLEM: Version data NOT found in output\n";
}
// Show a snippet of the models table
echo "\n=== MODELS TABLE SECTION ===\n";
if (preg_match('/<tbody[^>]*>.*?<\/tbody>/s', $html, $matches)) {
echo substr($matches[0], 0, 500) . "...\n";
}
} catch (\Exception $e) {
echo "❌ ERROR: " . $e->getMessage() . "\n";
echo "Trace:\n" . $e->getTraceAsString() . "\n";
}