Add service API for Meet to list and link virtual events.
Deploy Ladill Events / deploy (push) Successful in 1m17s
Deploy Ladill Events / deploy (push) Successful in 1m17s
Meet can attach existing conference or webinar rooms to event virtual sessions so registration stays in Events. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
<?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 ServiceMeetLinkTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected User $owner;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
config(['events.service_api_keys.meet' => 'test-meet-key']);
|
||||
config(['meet.key' => 'test-meet-key']);
|
||||
|
||||
Http::fake([
|
||||
config('meet.url').'/rooms' => Http::response([
|
||||
'room' => ['uuid' => 'room-uuid-123'],
|
||||
'join_url' => 'https://meet.ladill.com/r/room-uuid-123',
|
||||
], 201),
|
||||
]);
|
||||
|
||||
$this->owner = User::factory()->create(['public_id' => 'usr_meet_link']);
|
||||
}
|
||||
|
||||
public function test_service_api_lists_virtual_events(): void
|
||||
{
|
||||
QrCode::create([
|
||||
'user_id' => $this->owner->id,
|
||||
'short_code' => 'evt-virtual-1',
|
||||
'type' => QrCode::TYPE_EVENT,
|
||||
'label' => 'Virtual summit',
|
||||
'payload' => [
|
||||
'content' => [
|
||||
'title' => 'Virtual summit',
|
||||
'format' => 'virtual',
|
||||
'virtual_sessions' => [],
|
||||
],
|
||||
'style' => [],
|
||||
],
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$this->withToken('test-meet-key')
|
||||
->getJson('/api/service/v1/events?owner_ref='.$this->owner->public_id)
|
||||
->assertOk()
|
||||
->assertJsonPath('events.0.title', 'Virtual summit');
|
||||
}
|
||||
|
||||
public function test_service_api_links_existing_meet_room_to_event(): void
|
||||
{
|
||||
$event = QrCode::create([
|
||||
'user_id' => $this->owner->id,
|
||||
'short_code' => 'evt-link-1',
|
||||
'type' => QrCode::TYPE_EVENT,
|
||||
'label' => 'Hybrid day',
|
||||
'payload' => [
|
||||
'content' => [
|
||||
'title' => 'Hybrid day',
|
||||
'format' => 'hybrid',
|
||||
'virtual_sessions' => [],
|
||||
],
|
||||
'style' => [],
|
||||
],
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$this->withToken('test-meet-key')
|
||||
->postJson('/api/service/v1/events/'.$event->id.'/link-room', [
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'meet_room_uuid' => 'room-uuid-123',
|
||||
'meet_room_type' => 'webinar',
|
||||
'join_url' => 'https://meet.ladill.com/r/room-uuid-123',
|
||||
'title' => 'Keynote stream',
|
||||
])
|
||||
->assertOk()
|
||||
->assertJsonPath('event.meet_room_uuid', 'room-uuid-123');
|
||||
|
||||
$sessions = $event->fresh()->content()['virtual_sessions'];
|
||||
$this->assertSame('room-uuid-123', $sessions[0]['meet_room_uuid'] ?? null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user