updates for active directory
tests / ci (push) Canceled after 0s

This commit is contained in:
Mark Gregory
2026-11-11 16:19:50 +00:00
parent 65d58f19dc
commit c15221c98f
14 changed files with 592 additions and 2 deletions
+37
View File
@@ -1,8 +1,12 @@
<?php
use App\Models\User;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Str;
use Modules\Stylist\Providers\StylistServiceProvider;
it('resolves backend theme views', function () {
expect(View::exists('dashboard'))->toBeTrue()
@@ -30,3 +34,36 @@ it('renders the authenticated security settings', function () {
->get(route('security.edit'))
->assertOk();
});
it('resolves shared views using the request theme and preserves the backend layout namespace', function (string $uri, string $theme) {
$files = new Filesystem;
$root = sys_get_temp_dir().'/stylist-precedence-'.Str::uuid();
$request = Request::create($uri);
app()->instance('request', $request);
$console = new ReflectionProperty(app(), 'isRunningInConsole');
$console->setValue(app(), false);
try {
foreach (['frontend', 'backend'] as $key) {
$files->makeDirectory("$root/$key/views/layouts", recursive: true);
$files->copy(resource_path("themes/$key/theme.json"), "$root/$key/theme.json");
$files->put("$root/$key/views/layouts/app.blade.php", $key);
}
$files->put("$root/frontend/views/welcome.blade.php", 'welcome');
$files->put("$root/backend/views/dashboard.blade.php", 'dashboard');
config(['stylist.themes_path' => $root]);
app()->getProvider(StylistServiceProvider::class)->boot();
$finder = View::getFinder();
expect($finder->find('layouts.app'))->toBe("$root/$theme/views/layouts/app.blade.php")
->and($finder->find('layouts::app'))->toBe("$root/backend/views/layouts/app.blade.php")
->and($finder->find('welcome'))->toBe("$root/frontend/views/welcome.blade.php")
->and($finder->find('dashboard'))->toBe("$root/backend/views/dashboard.blade.php");
} finally {
$console->setValue(app(), true);
$files->deleteDirectory($root);
}
})->with([
'frontend request' => ['/', 'frontend'],
'backend request' => ['/dashboard', 'backend'],
]);