42 lines
1.2 KiB
PHP
Executable File
42 lines
1.2 KiB
PHP
Executable File
<?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();
|
|
}
|
|
}
|