Merge pull request 'feat: PHPUnit Test-Infrastruktur und Router-Tests' (#64) from feature/phpunit-tests into main
All checks were successful
Lint / PHP Syntax Check (push) Successful in 33s
Lint / CSS Lint (stylelint) (push) Successful in 1m12s
Lint / HTML Lint (htmlhint) (push) Successful in 1m9s

This commit is contained in:
2026-05-22 21:33:32 +02:00
12 changed files with 2546 additions and 22 deletions

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.
*/
// Autoloader (PSR-4 style, simple)
spl_autoload_register(function (string $class): void {
$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;
}
});
// Autoloader (composer PSR-4)
require_once __DIR__ . '/../vendor/autoload.php';
use App\Core\Router;