Files
ladill-events/tests/Feature/EventSpeakerManagementTest.php
T
isaaccladandCursor 42d997a599
Deploy Ladill Events / deploy (push) Successful in 42s
Fix Blade syntax error on event speakers page.
Split inline @if directives in programme assignment rows so the speakers view compiles and loads without a 500.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 15:18:50 +00:00

130 lines
4.4 KiB
PHP

<?php
namespace Tests\Feature;
use App\Models\QrCode;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Http;
use Tests\TestCase;
class EventSpeakerManagementTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
$this->withoutMiddleware(\App\Http\Middleware\EnsurePlatformSession::class);
Http::fake([
config('billing.api_url').'/balance*' => Http::response(['balance_minor' => 50000]),
]);
}
public function test_speakers_sidebar_hub_lists_events(): void
{
$owner = User::factory()->create(['public_id' => 'usr_speakers_hub']);
QrCode::create([
'user_id' => $owner->id,
'short_code' => 'evt-speakers-1',
'type' => QrCode::TYPE_EVENT,
'label' => 'Leadership summit',
'payload' => ['content' => ['name' => 'Leadership summit', 'speakers' => [['name' => 'Ada Lovelace', 'email' => '', 'role' => 'Keynote', 'bio' => '']]], 'style' => []],
'is_active' => true,
]);
$this->actingAs($owner)
->get(route('speakers.index'))
->assertOk()
->assertSee('Leadership summit', false)
->assertSee('Speakers', false);
}
public function test_event_speakers_page_renders(): void
{
$owner = User::factory()->create(['public_id' => 'usr_speakers_show']);
$event = QrCode::create([
'user_id' => $owner->id,
'short_code' => 'evt-speakers-show',
'type' => QrCode::TYPE_EVENT,
'label' => 'Summit day',
'payload' => [
'content' => [
'name' => 'Summit day',
'speakers' => [['name' => 'Ada Lovelace', 'email' => '', 'role' => 'Keynote', 'bio' => '']],
],
'style' => [],
],
'is_active' => true,
]);
$this->actingAs($owner)
->get(route('speakers.show', $event))
->assertOk()
->assertSee('Speaker management', false)
->assertSee('Ada Lovelace', false);
}
public function test_event_speaker_roster_can_be_updated(): void
{
$owner = User::factory()->create(['public_id' => 'usr_speakers_upd']);
$event = QrCode::create([
'user_id' => $owner->id,
'short_code' => 'evt-speakers-2',
'type' => QrCode::TYPE_EVENT,
'label' => 'Dev day',
'payload' => ['content' => ['name' => 'Dev day'], 'style' => []],
'is_active' => true,
]);
$this->actingAs($owner)
->put(route('speakers.update', $event), [
'speakers' => [
['name' => 'Jane Doe', 'email' => 'jane@example.com', 'role' => 'Panelist', 'bio' => ''],
],
])
->assertRedirect(route('speakers.show', $event));
$event->refresh();
$this->assertSame('Jane Doe', $event->content()['speakers'][0]['name']);
$this->assertSame('jane@example.com', $event->content()['speakers'][0]['email']);
}
public function test_event_create_page_has_no_qr_design_wizard(): void
{
$owner = User::factory()->create(['public_id' => 'usr_evt_create_simple']);
$this->actingAs($owner)
->get(route('events.create'))
->assertOk()
->assertSee('Create event', false)
->assertSee('generated automatically', false)
->assertDontSee('Quick style presets', false)
->assertDontSee('Review &amp; create', false);
}
public function test_event_show_page_has_downloads_not_qr_customizer(): void
{
$owner = User::factory()->create(['public_id' => 'usr_evt_show_simple']);
$event = QrCode::create([
'user_id' => $owner->id,
'short_code' => 'evt-show-simple',
'type' => QrCode::TYPE_EVENT,
'label' => 'Simple show',
'payload' => ['content' => ['name' => 'Simple show'], 'style' => []],
'is_active' => true,
]);
$this->actingAs($owner)
->get(route('events.show', $event))
->assertOk()
->assertSee('Customize colors, logos, and frames in QR Plus.', false)
->assertSee('Programme outline', false)
->assertDontSee('Quick style presets', false);
}
}