feat: PHPUnit Test-Infrastruktur und Router-Tests #64

Merged
greggy merged 2 commits from feature/phpunit-tests into main 2026-05-22 21:33:32 +02:00
Showing only changes of commit 3a30abc05e - Show all commits

24
public/index.php Normal file → Executable file
View File

@@ -7,28 +7,8 @@ declare(strict_types=1);
* All requests are routed through this file. * All requests are routed through this file.
*/ */
// Autoloader (PSR-4 style, simple) // Autoloader (composer PSR-4)
spl_autoload_register(function (string $class): void { require_once __DIR__ . '/../vendor/autoload.php';
$prefix = 'App\\';
$baseDir = __DIR__ . '/../app/';
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
return;
}
$relativeClass = substr($class, $len);
// Lowercase directory names, keep class name case
$parts = explode('\\', $relativeClass);
$className = array_pop($parts);
$parts = array_map('strtolower', $parts);
$parts[] = $className;
$file = $baseDir . implode('/', $parts) . '.php';
if (file_exists($file)) {
require $file;
}
});
use App\Core\Router; use App\Core\Router;