Eigene Fotokategorie fuer Grundrisse und Plaene, nie in Galerien

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-10-29 18:43:02 +01:00
1 parent 8bcda9a4bc
commit d02f3e05c7
7 files changed
+85 -4

No files matched your search

+34
View File
@@ -2,6 +2,7 @@
namespace Tests\Feature;
use App\Enums\PhotoCategory;
use App\Enums\UserRole;
use App\Filament\Resources\FloorPlans\FloorPlanResource;
use App\Filament\Resources\FloorPlans\Pages\CreateFloorPlan;
@@ -77,6 +78,39 @@ public function test_section_shows_visible_rooms_with_area_photo_equipment_and_h
->assertDontSee('Ohne Fläche');
}
public function test_plan_pictures_serve_the_floor_plan_even_when_hidden_but_never_appear_in_galleries(): void
{
$plan = Photo::factory()->create(['category' => PhotoCategory::Plan, 'is_published' => false]);
Photo::factory()->create(['alt_text' => 'Lageplan des Hauses', 'category' => PhotoCategory::Plan]);
Photo::factory()->create(['alt_text' => 'Wohnzimmer mit Erker', 'category' => PhotoCategory::Apartment]);
FloorPlan::factory()->for($this->property)->create([
'photo_id' => $plan->id,
'rooms' => [['id' => 'a', 'name' => 'Bad', 'points' => '50,40 66,40 66,65', 'is_visible' => true]],
]);
$this->placeSectionOnApartmentPage();
$page = Site::sole()->pages()->where('slug', 'wohnung')->sole();
$page->update(['sections' => [...$page->sections, ['type' => 'gallery', 'data' => ['heading' => 'Alle Bilder', 'category' => 'all']]]]);
$this->get('/wohnung')
->assertOk()
->assertSee('points="50,40 66,40 66,65"', false)
->assertSee('Wohnzimmer mit Erker')
->assertDontSee('Lageplan des Hauses');
}
public function test_floor_plan_pictures_move_to_the_plan_category(): void
{
$plan = Photo::factory()->create(['category' => PhotoCategory::Apartment, 'is_published' => false]);
$other = Photo::factory()->create(['category' => PhotoCategory::Apartment]);
FloorPlan::factory()->for($this->property)->create(['photo_id' => $plan->id]);
(require database_path('migrations/2026_10_29_184027_move_floor_plan_pictures_to_the_plan_category.php'))->up();
$this->assertSame(PhotoCategory::Plan, $plan->fresh()->category);
$this->assertFalse($plan->fresh()->is_published);
$this->assertSame(PhotoCategory::Apartment, $other->fresh()->category);
}
public function test_section_shows_nothing_without_a_floor_plan(): void
{
$this->placeSectionOnApartmentPage();