feat: PHPUnit Test-Infrastruktur und Router-Tests #64
24
public/index.php
Normal file → Executable file
24
public/index.php
Normal file → Executable 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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user