Files
michaelschiemer/tests/debug/test-web-initializers.php
Michael Schiemer 36ef2a1e2c
Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Failing after 10m14s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Has been skipped
🚀 Build & Deploy Image / Build Docker Image (push) Has been skipped
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
Security Vulnerability Scan / Check for Dependency Changes (push) Failing after 11m25s
Security Vulnerability Scan / Composer Security Audit (push) Has been cancelled
fix: Gitea Traefik routing and connection pool optimization
- Remove middleware reference from Gitea Traefik labels (caused routing issues)
- Optimize Gitea connection pool settings (MAX_IDLE_CONNS=30, authentication_timeout=180s)
- Add explicit service reference in Traefik labels
- Fix intermittent 504 timeouts by improving PostgreSQL connection handling

Fixes Gitea unreachability via git.michaelschiemer.de
2025-11-09 14:46:15 +01:00

96 lines
3.4 KiB
PHP

<?php
declare(strict_types=1);
// Simulate web environment
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['HTTP_HOST'] = 'localhost';
$_SERVER['SERVER_NAME'] = 'localhost';
$_SERVER['SCRIPT_NAME'] = '/index.php';
require_once __DIR__ . '/../../vendor/autoload.php';
use App\Framework\Cache\Driver\InMemoryCache;
use App\Framework\Cache\GeneralCache;
use App\Framework\Context\ExecutionContext;
use App\Framework\Core\PathProvider;
use App\Framework\DateTime\SystemClock;
use App\Framework\DI\DefaultContainer;
use App\Framework\Discovery\DiscoveryServiceBootstrapper;
use App\Framework\ReflectionLegacy\CachedReflectionProvider;
use App\Framework\Serializer\Json\JsonSerializer;
echo "=== Testing Web Context Initializer Execution ===\n\n";
try {
$projectRoot = dirname(__DIR__, 2);
echo "Project root: $projectRoot\n";
echo "Simulated context: " . ExecutionContext::detect()->getType()->value . "\n\n";
$container = new DefaultContainer();
$pathProvider = new PathProvider($projectRoot);
$clock = new SystemClock();
// Create cache for discovery
$cacheDriver = new InMemoryCache();
$serializer = new JsonSerializer();
$cache = new GeneralCache($cacheDriver, $serializer);
// Register required dependencies
$container->instance(PathProvider::class, $pathProvider);
$container->instance(\App\Framework\Cache\CacheDriver::class, $cacheDriver);
$container->instance(\App\Framework\Serializer\Serializer::class, $serializer);
$container->instance(\App\Framework\Cache\Cache::class, $cache);
$container->instance(\App\Framework\DateTime\Clock::class, $clock);
$container->instance(\App\Framework\ReflectionLegacy\ReflectionProvider::class, new CachedReflectionProvider());
// Create bootstrapper
$bootstrapper = new DiscoveryServiceBootstrapper($container, $clock);
echo "Starting web bootstrap process...\n";
// This should discover AND execute initializers for web context
$registry = $bootstrapper->bootstrap();
echo "\nWeb Bootstrap completed!\n\n";
// Check what initializers were found
$initializerAttributeClass = 'App\\Framework\\DI\\Initializer';
$initializers = $registry->attributes->get($initializerAttributeClass);
echo "=== Web Context Initializer Results ===\n";
echo "Initializers found: " . count($initializers) . "\n\n";
// Check if web-specific services are available
$webServices = [
'App\\Framework\\Http\\MiddlewareManagerInterface',
'App\\Framework\\Http\\Session\\SessionManager',
'App\\Framework\\Security\\RequestSigning\\RequestSigning',
'App\\Framework\\Waf\\WafEngine',
'App\\Framework\\Http\\RequestFactory',
];
echo "=== Web-Specific Services ===\n";
foreach ($webServices as $service) {
$exists = $container->has($service);
echo "- $service: " . ($exists ? "✅ Available" : "❌ Missing") . "\n";
}
echo "\n=== Core Services ===\n";
$coreServices = [
'App\\Framework\\Cache\\Cache',
'App\\Framework\\Logging\\Logger',
'App\\Framework\\Database\\EntityManager',
];
foreach ($coreServices as $service) {
$exists = $container->has($service);
echo "- $service: " . ($exists ? "✅ Available" : "❌ Missing") . "\n";
}
} catch (Exception $e) {
echo "❌ Error: " . $e->getMessage() . "\n";
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
}