Hotfix: Livewire-UI-Komponenten im Ordner Ui (wie der Namespace)
Der Ordner hieß im Repository UI, der Namespace App\Livewire\Web\Components\Ui. Auf dem Mac fällt das nicht auf, auf Linux findet der Autoloader die Klassen nicht: Header, Footer usw. rendern ohne Klasse (500, Undefined variable $logoPath). Wächtertest prüft Pfad und Namespace auf gleiche Schreibweise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
cbf04e1f9c
commit
83799d7bc5
7 changed files with 33 additions and 0 deletions
33
tests/Unit/NamespacePathCaseTest.php
Normal file
33
tests/Unit/NamespacePathCaseTest.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Der Live-Server (Linux) unterscheidet Groß- und Kleinschreibung, macOS nicht. Weicht ein
|
||||
* Ordnername nur in der Schreibweise vom Namespace ab (UI statt Ui), findet der Autoloader die
|
||||
* Klasse lokal, auf Live aber nicht (09.10.2026: Header ohne Klasse, 500 nach dem Deploy).
|
||||
*/
|
||||
it('keeps every class path in the exact case of its namespace', function () {
|
||||
$root = dirname(__DIR__, 2);
|
||||
exec('git -C '.escapeshellarg($root).' ls-files app database/seeders database/factories', $files);
|
||||
|
||||
$roots = ['app/' => 'App/', 'database/seeders/' => 'Database/Seeders/', 'database/factories/' => 'Database/Factories/'];
|
||||
$mismatches = [];
|
||||
|
||||
foreach ($files as $file) {
|
||||
if (! str_ends_with($file, '.php') || ! preg_match('/^namespace\s+([^;]+);/m', (string) file_get_contents($root.'/'.$file), $match)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($roots as $path => $namespacePath) {
|
||||
if (str_starts_with($file, $path)) {
|
||||
$expected = dirname($namespacePath.substr($file, strlen($path)));
|
||||
$declared = str_replace('\\', '/', $match[1]);
|
||||
|
||||
if ($declared !== $expected && strcasecmp($declared, $expected) === 0) {
|
||||
$mismatches[] = "{$file} → {$match[1]}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
expect($mismatches)->toBe([]);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue