Files
HolidayParks/Modules/Stylist/Tests/Feature/ThemeAssetControllerTest.php
Mark Gregory 0a74f5b44e
tests / ci (push) Canceled after 0s
initial commmit
2026-09-30 14:24:42 +01:00

42 lines
1.2 KiB
PHP

<?php
namespace Modules\Stylist\Tests\Feature;
use Modules\Stylist\Theme\Loader;
use Tests\TestCase;
final class ThemeAssetControllerTest extends TestCase
{
public function test_active_theme_css_is_served(): void
{
config(['stylist.themes_path' => resource_path('themes')]);
app(Loader::class)->flush();
$this->get(route('stylist.theme.asset', [
'theme' => 'frontend',
'path' => 'css/theme.css',
]))->assertOk()->assertHeader('X-Content-Type-Options', 'nosniff');
}
public function test_asset_url_uses_public_themes_path(): void
{
$url = route('stylist.theme.asset', [
'theme' => 'frontend',
'path' => 'images/example.jpg',
], false);
$this->assertSame('/themes/frontend/images/example.jpg', $url);
}
public function test_non_asset_theme_files_are_not_served(): void
{
config(['stylist.themes_path' => resource_path('themes')]);
app(Loader::class)->flush();
$this->get(route('stylist.theme.asset', [
'theme' => 'frontend',
'path' => 'views/home.blade.php',
]))->assertNotFound();
}
}