Files
fotospiel-app/tests/Feature/Marketing/DemoPageTest.php
Codex Agent 6eafec2128
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled
Add marketing demo toggle and tolerate string flags
2026-02-05 11:50:36 +01:00

68 lines
1.8 KiB
PHP

<?php
namespace Tests\Feature\Marketing;
use App\Models\Event;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Inertia\Testing\AssertableInertia as Assert;
use Tests\TestCase;
class DemoPageTest extends TestCase
{
use RefreshDatabase;
public function test_demo_page_uses_marketing_demo_event(): void
{
$event = Event::factory()->create([
'settings' => ['marketing_demo' => true],
]);
$joinToken = $event->joinTokens()->latest('id')->first();
$this->assertNotNull($joinToken);
$response = $this->get('/de/demo');
$response->assertOk();
$response->assertInertia(fn (Assert $page) => $page
->component('marketing/Demo')
->where('demoToken', $joinToken->token)
);
}
public function test_demo_page_accepts_string_demo_flags(): void
{
$eventA = Event::factory()->create([
'settings' => ['marketing_demo' => 'true'],
]);
$eventB = Event::factory()->create([
'settings' => ['demo' => 'true'],
]);
$joinToken = $eventB->joinTokens()->latest('id')->first();
$this->assertNotNull($eventA);
$this->assertNotNull($joinToken);
$response = $this->get('/de/demo');
$response->assertOk();
$response->assertInertia(fn (Assert $page) => $page
->component('marketing/Demo')
->where('demoToken', $joinToken->token)
);
}
public function test_demo_page_renders_without_marketing_demo_event(): void
{
$response = $this->get('/de/demo');
$response->assertOk();
$response->assertInertia(fn (Assert $page) => $page
->component('marketing/Demo')
->where('demoToken', null)
);
}
}