themes how part of site settings

This commit is contained in:
Mark Gregory
2026-07-28 12:43:19 +01:00
parent eafc5e8063
commit f834328044
12 changed files with 144 additions and 18 deletions
@@ -0,0 +1,27 @@
<?php
use Modules\Settings\Services\SettingsRepository;
use Modules\Stylist\Theme\Stylist;
it('stores separate active frontend and backend themes in site settings', function (): void {
$settings = app(SettingsRepository::class);
$settings->put('frontend_theme', 'swiss', 'site', 'string', true);
$settings->put('backend_theme', 'admin', 'site', 'string', true);
expect($settings->site())
->frontend_theme->toBe('swiss')
->backend_theme->toBe('admin');
expect(app(Stylist::class)->frontend()->key())->toBe('swiss')
->and(app(Stylist::class)->backend()->key())->toBe('admin');
});
it('falls back to configured themes when stored theme keys are unavailable', function (): void {
$settings = app(SettingsRepository::class);
$settings->put('frontend_theme', 'missing-theme', 'site', 'string', true);
$settings->put('backend_theme', 'missing-theme', 'site', 'string', true);
expect(app(Stylist::class)->frontend()->key())->toBe(config('stylist.default_frontend_theme'))
->and(app(Stylist::class)->backend()->key())->toBe(config('stylist.default_backend_theme'));
});