Files
fotospiel-app/tests/Feature/Api/Event/EventQrCodeTest.php
Codex Agent 298a8375b6
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled
Update guest v2 branding and theming
2026-02-03 15:18:44 +01:00

36 lines
948 B
PHP

<?php
namespace Tests\Feature\Api\Event;
use App\Models\Event;
use App\Services\EventJoinTokenService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class EventQrCodeTest extends TestCase
{
use RefreshDatabase;
public function test_guest_can_fetch_event_qr_code(): void
{
$event = Event::factory()->create([
'status' => 'published',
]);
$token = app(EventJoinTokenService::class)->createToken($event);
$response = $this->getJson("/api/v1/events/{$token->token}/qr?size=240");
$response->assertOk()
->assertJsonStructure([
'url',
'qr_code_data_url',
])
->assertJsonPath('url', url('/e/'.$token->token));
$dataUrl = $response->json('qr_code_data_url');
$this->assertIsString($dataUrl);
$this->assertStringStartsWith('data:image/png;base64,', $dataUrl);
}
}