Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Controller/OpenViduTest.php
Show All 9 Lines | |||||
{ | { | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function setUp(): void | public function setUp(): void | ||||
{ | { | ||||
parent::setUp(); | parent::setUp(); | ||||
$this->clearBetaEntitlements(); | $this->clearMeetEntitlements(); | ||||
$room = Room::where('name', 'john')->first(); | $room = Room::where('name', 'john')->first(); | ||||
$room->setSettings(['password' => null, 'locked' => null]); | $room->setSettings(['password' => null, 'locked' => null]); | ||||
} | } | ||||
public function tearDown(): void | public function tearDown(): void | ||||
{ | { | ||||
$this->clearBetaEntitlements(); | $this->clearMeetEntitlements(); | ||||
$room = Room::where('name', 'john')->first(); | $room = Room::where('name', 'john')->first(); | ||||
$room->setSettings(['password' => null, 'locked' => null]); | $room->setSettings(['password' => null, 'locked' => null]); | ||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
/** | /** | ||||
* Test listing user rooms | * Test listing user rooms | ||||
Show All 39 Lines | class OpenViduTest extends TestCase | ||||
public function testJoinRoom(): void | public function testJoinRoom(): void | ||||
{ | { | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$jack = $this->getTestUser('jack@kolab.org'); | $jack = $this->getTestUser('jack@kolab.org'); | ||||
$room = Room::where('name', 'john')->first(); | $room = Room::where('name', 'john')->first(); | ||||
$room->session_id = null; | $room->session_id = null; | ||||
$room->save(); | $room->save(); | ||||
$this->assignBetaEntitlement($john, 'meet'); | $this->assignMeetEntitlement($john); | ||||
// Unauth access, no session yet | // Unauth access, no session yet | ||||
$response = $this->post("api/v4/openvidu/rooms/{$room->name}"); | $response = $this->post("api/v4/openvidu/rooms/{$room->name}"); | ||||
$response->assertStatus(422); | $response->assertStatus(422); | ||||
$json = $response->json(); | $json = $response->json(); | ||||
$this->assertSame(323, $json['code']); | $this->assertSame(323, $json['code']); | ||||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | class OpenViduTest extends TestCase | ||||
{ | { | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$jack = $this->getTestUser('jack@kolab.org'); | $jack = $this->getTestUser('jack@kolab.org'); | ||||
$room = Room::where('name', 'john')->first(); | $room = Room::where('name', 'john')->first(); | ||||
$room->session_id = null; | $room->session_id = null; | ||||
$room->save(); | $room->save(); | ||||
$room->setSettings(['password' => null, 'locked' => 'true']); | $room->setSettings(['password' => null, 'locked' => 'true']); | ||||
$this->assignBetaEntitlement($john, 'meet'); | $this->assignMeetEntitlement($john); | ||||
// Create the session (also makes sure the owner can access a locked room) | // Create the session (also makes sure the owner can access a locked room) | ||||
$response = $this->actingAs($john)->post("api/v4/openvidu/rooms/{$room->name}", ['init' => 1]); | $response = $this->actingAs($john)->post("api/v4/openvidu/rooms/{$room->name}", ['init' => 1]); | ||||
$response->assertStatus(200); | $response->assertStatus(200); | ||||
// Non-owner, locked room, invalid/missing input | // Non-owner, locked room, invalid/missing input | ||||
$response = $this->actingAs($jack)->post("api/v4/openvidu/rooms/{$room->name}"); | $response = $this->actingAs($jack)->post("api/v4/openvidu/rooms/{$room->name}"); | ||||
$response->assertStatus(422); | $response->assertStatus(422); | ||||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | class OpenViduTest extends TestCase | ||||
/** | /** | ||||
* Test joining the room | * Test joining the room | ||||
* | * | ||||
* @group openvidu | * @group openvidu | ||||
* @depends testJoinRoom | * @depends testJoinRoom | ||||
*/ | */ | ||||
public function testJoinRoomGuest(): void | public function testJoinRoomGuest(): void | ||||
{ | { | ||||
$this->assignBetaEntitlement('john@kolab.org', 'meet'); | $this->assignMeetEntitlement('john@kolab.org'); | ||||
// There's no asy way to logout the user in the same test after | // There's no asy way to logout the user in the same test after | ||||
// using actingAs(). That's why this is moved to a separate test | // using actingAs(). That's why this is moved to a separate test | ||||
$room = Room::where('name', 'john')->first(); | $room = Room::where('name', 'john')->first(); | ||||
// Guest, request with screenShare token | // Guest, request with screenShare token | ||||
$post = ['canPublish' => true, 'screenShare' => 1, 'init' => 1]; | $post = ['canPublish' => true, 'screenShare' => 1, 'init' => 1]; | ||||
$response = $this->post("api/v4/openvidu/rooms/{$room->name}", $post); | $response = $this->post("api/v4/openvidu/rooms/{$room->name}", $post); | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | class OpenViduTest extends TestCase | ||||
public function testDismissConnection(): void | public function testDismissConnection(): void | ||||
{ | { | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$jack = $this->getTestUser('jack@kolab.org'); | $jack = $this->getTestUser('jack@kolab.org'); | ||||
$room = Room::where('name', 'john')->first(); | $room = Room::where('name', 'john')->first(); | ||||
$room->session_id = null; | $room->session_id = null; | ||||
$room->save(); | $room->save(); | ||||
$this->assignBetaEntitlement($john, 'meet'); | $this->assignMeetEntitlement($john); | ||||
// First we create the session | // First we create the session | ||||
$response = $this->actingAs($john)->post("api/v4/openvidu/rooms/{$room->name}", ['init' => 1]); | $response = $this->actingAs($john)->post("api/v4/openvidu/rooms/{$room->name}", ['init' => 1]); | ||||
$response->assertStatus(200); | $response->assertStatus(200); | ||||
$json = $response->json(); | $json = $response->json(); | ||||
// And the other user connection | // And the other user connection | ||||
▲ Show 20 Lines • Show All 119 Lines • Show Last 20 Lines |