themes how part of site settings
This commit is contained in:
@@ -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'));
|
||||
});
|
||||
Reference in New Issue
Block a user