Files
fewo-stommer/tests/Feature/InstalledThemesRenderTest.php
LarsandClaude Opus 5.5 f7cbc66451
Deploy / test (push) Failing after 2s
Deploy / deploy (push) Skipped
Section "Grundriss (interaktiv)": floor plan with rooms, admin editor, Seebad view
- Table floor_plans (tenant_id, one per apartment, picture = website photo, rooms as JSON with
  corners in percent of the picture), model FloorPlan with BelongsToTenant, Property::floorPlan()
- Admin › Webseite › Grundriss: room list with name, description, photos, equipment (from the
  equipment list), accessibility hint, visibility, and an area editor (click the corners on the picture)
- Section floor_plan: base view without JavaScript (areas jump to the room list), Seebad view with
  room buttons, highlighted area and a cartouche per room (theme.js initFloorPlans)
- Tests: tenant inheritance, point parsing, website output, admin create incl. validation; the
  render test for all themes now includes the floor plan
- Docs: THEMES §5, ZUSAMMENARBEIT §6, STATUS §6 (incl. note for tenancy phase 5)
- styles/grundriss: revised rendering, WebP renditions, room areas of the Stommer flat in percent

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

73 lines
2.7 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\FloorPlan;
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]);
FloorPlan::factory()->for($property)->create();
$apartment = Page::query()->where('slug', 'wohnung')->sole();
$apartment->update(['sections' => [...$apartment->sections, ['type' => 'floor_plan', 'data' => ['heading' => 'Der Grundriss']]]]);
}
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();
}
$this->get('/wohnung')->assertSee('Der Grundriss')->assertSee('Wohnbereich');
}
}
}