getType()->value . "\n\n"; // Bootstrap console application exactly like console.php echo "2. Bootstrapping Console Application:\n"; try { echo " - Creating console application...\n"; $consoleApp = $bootstrapper->bootstrapConsole(); echo " - Console application created successfully\n"; // Now get the discovery registry from the container $container = $consoleApp->getContainer(); if ($container->has(DiscoveryRegistry::class)) { echo " - DiscoveryRegistry found in container\n"; $registry = $container->get(DiscoveryRegistry::class); echo " - Registry empty: " . ($registry->isEmpty() ? 'YES' : 'NO') . "\n"; echo " - Total attribute types: " . count($registry->attributes->getAllTypes()) . "\n"; $consoleCommands = $registry->attributes->get(ConsoleCommand::class); echo " - ConsoleCommand attributes found: " . count($consoleCommands) . "\n"; // List all types found echo " - All discovered types:\n"; foreach ($registry->attributes->getAllTypes() as $type) { $count = $registry->attributes->getCount($type); echo " * $type: $count instances\n"; if ($type === ConsoleCommand::class && $count > 0) { echo " Sample commands:\n"; $commands = $registry->attributes->get($type); $sampleCount = 0; foreach ($commands as $discovered) { if ($sampleCount >= 3) { break; } $command = $discovered->createAttributeInstance(); echo " - " . $command->name . "\n"; $sampleCount++; } } } } else { echo " - ❌ DiscoveryRegistry not found in container\n"; } } catch (\Throwable $e) { echo " - ❌ Error: " . $e->getMessage() . "\n"; echo " - File: " . $e->getFile() . ":" . $e->getLine() . "\n"; echo " - Stack trace:\n" . $e->getTraceAsString() . "\n"; } echo "\n=== End Test ===\n";