Files
michaelschiemer/tests/debug/direct-discovery-test.php
Michael Schiemer 5050c7d73a docs: consolidate documentation into organized structure
- Move 12 markdown files from root to docs/ subdirectories
- Organize documentation by category:
  • docs/troubleshooting/ (1 file)  - Technical troubleshooting guides
  • docs/deployment/      (4 files) - Deployment and security documentation
  • docs/guides/          (3 files) - Feature-specific guides
  • docs/planning/        (4 files) - Planning and improvement proposals

Root directory cleanup:
- Reduced from 16 to 4 markdown files in root
- Only essential project files remain:
  • CLAUDE.md (AI instructions)
  • README.md (Main project readme)
  • CLEANUP_PLAN.md (Current cleanup plan)
  • SRC_STRUCTURE_IMPROVEMENTS.md (Structure improvements)

This improves:
 Documentation discoverability
 Logical organization by purpose
 Clean root directory
 Better maintainability
2025-10-05 11:05:04 +02:00

88 lines
3.5 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/../../vendor/autoload.php';
use App\Framework\Attributes\Route;
use App\Framework\Core\PathProvider;
use App\Framework\Discovery\DiscoveryServiceBootstrapper;
use App\Framework\Discovery\Results\DiscoveryRegistry;
use App\Framework\DI\DefaultContainer;
echo "=== Direct Discovery Test ===\n";
try {
// Create minimal container and path provider
$container = new DefaultContainer();
$basePath = dirname(__DIR__, 2);
$pathProvider = new PathProvider($basePath);
$container->singleton(PathProvider::class, $pathProvider);
// Bootstrap discovery service
$discoveryBootstrapper = new DiscoveryServiceBootstrapper();
$discoveryBootstrapper->initialize($container);
// Get the discovery registry
$discoveryRegistry = $container->resolve(DiscoveryRegistry::class);
echo "Discovery Registry successfully loaded\n";
// Check total Route attributes discovered
$routeCount = $discoveryRegistry->attributes->getCount(Route::class);
echo "Total Route attributes found: $routeCount\n\n";
if ($routeCount > 0) {
$routes = $discoveryRegistry->attributes->get(Route::class);
echo "=== Searching for ShowImage Route ===\n";
// Search specifically for ShowImage
$showImageRoutes = array_filter($routes, function($route) {
return str_contains($route->filePath->normalized ?? '', 'ShowImage.php');
});
echo "ShowImage routes found: " . count($showImageRoutes) . "\n";
if (count($showImageRoutes) > 0) {
foreach ($showImageRoutes as $route) {
echo "*** FOUND ShowImage route! ***\n";
echo " Path: " . ($route->additionalData['path'] ?? 'unknown') . "\n";
echo " Method: " . ($route->additionalData['http_method'] ?? 'unknown') . "\n";
echo " Class: " . ($route->additionalData['class'] ?? 'unknown') . "\n";
echo " File: " . ($route->filePath->normalized ?? 'unknown') . "\n";
}
} else {
echo "❌ ShowImage route NOT found in discovery\n";
// Let's look at a few sample routes to understand the pattern
echo "\n=== Sample Routes for Debugging ===\n";
foreach (array_slice($routes, 0, 5) as $index => $route) {
echo "Route " . ($index + 1) . ":\n";
echo " File: " . ($route->filePath->normalized ?? 'unknown') . "\n";
echo " Class: " . ($route->additionalData['class'] ?? 'unknown') . "\n";
echo " Path: " . ($route->additionalData['path'] ?? 'unknown') . "\n";
echo "\n";
}
// Look for files in Application/Media directory
echo "=== Looking for files in Application/Media ===\n";
$mediaRoutes = array_filter($routes, function($route) {
return str_contains($route->filePath->normalized ?? '', 'Application/Media');
});
echo "Routes in Application/Media: " . count($mediaRoutes) . "\n";
foreach ($mediaRoutes as $route) {
echo " File: " . ($route->filePath->normalized ?? 'unknown') . "\n";
echo " Class: " . ($route->additionalData['class'] ?? 'unknown') . "\n";
}
}
} else {
echo "❌ No routes found in discovery registry!\n";
}
} catch (Exception $e) {
echo "❌ Error during discovery test: " . $e->getMessage() . "\n";
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
}