Files
fewo-stommer/tests/Feature/InstalledThemesRenderTest.php
LarsandClaude Opus 5.5 d2f53ceb84 Theme Seebad 0.4.0: menu panels; fix missing chevron icons; render test for all themes
- Menu panels: arrow next to each main menu item opens a panel with the page description (SEO text),
  jump links to the headed sections and a cartouche with booking and phone; Escape/outside click closes,
  focus returns; without JavaScript the menu stays plain links
- Header: booking button hidden between 1280 and 1535 px (too narrow with the arrows), desktop phone removed
- Fix: offers carousel and menu used outline chevron icons that do not exist (500 as soon as offers are shown);
  now mini chevrons
- New test: every installed theme renders all pages with reviews and offers in every display mode
- Wish: menu photo per page (ZUSAMMENARBEIT §5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:33:11 +02:00

66 lines
2.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace Tests\Feature;
use App\Enums\ReviewStatus;
use App\Models\Page;
use App\Models\Property;
use App\Models\Review;
use App\Models\Site;
use App\Models\SpecialOffer;
use App\Themes\ThemeRegistry;
use Carbon\CarbonImmutable;
use Database\Seeders\PropertySeeder;
use Database\Seeders\SiteSeeder;
use Database\Seeders\WebsiteContentSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
/**
* Every installed theme must render every page with real content in every display mode – a template that only
* breaks when data exists (e.g. offers shown as a carousel) would otherwise go unnoticed until it is live.
*/
class InstalledThemesRenderTest extends TestCase
{
use RefreshDatabase;
private const PAGES = ['/', '/wohnung', '/kuehlungsborn', '/buchen', '/kontakt', '/impressum', '/datenschutz'];
protected function setUp(): void
{
parent::setUp();
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
$this->seed([PropertySeeder::class, WebsiteContentSeeder::class, SiteSeeder::class]);
$this->withoutVite();
$property = Property::sole();
Review::factory()->for($property)->count(2)->create(['status' => ReviewStatus::Approved]);
SpecialOffer::factory()->for($property)->create(['name' => 'Herbstwochen', 'is_featured' => true]);
SpecialOffer::factory()->for($property)->create(['name' => 'Ab 5 Nächten', 'min_nights' => 5]);
}
public function test_every_installed_theme_renders_all_pages_with_offers_in_every_display_mode(): void
{
$site = Site::sole();
$home = Page::query()->where('slug', Page::HOME)->sole();
foreach (array_keys(app(ThemeRegistry::class)->all()) as $themeKey) {
$site->update(['theme' => $themeKey]);
foreach (['grid', 'list', 'rotating'] as $display) {
$home->update(['sections' => array_map(
fn (array $section): array => $section['type'] === 'offers' ? [...$section, 'data' => [...$section['data'], 'display' => $display]] : $section,
$home->sections,
)]);
$this->get('/')->assertOk()->assertSee('Herbstwochen');
}
foreach (self::PAGES as $path) {
$this->get($path)->assertOk();
}
}
}
}