laravel-webrtc/tests/RoomTypeTest.php

33 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace Blax\WebRtc\Tests;
use Blax\WebRtc\Rooms\RoomType;
use PHPUnit\Framework\TestCase;
final class RoomTypeTest extends TestCase
{
public function test_derives_the_type_from_the_room_name_prefix(): void
{
$this->assertSame(RoomType::Public, RoomType::fromName('lobby'));
$this->assertSame(RoomType::Private, RoomType::fromName('private-standup'));
$this->assertSame(RoomType::Presence, RoomType::fromName('presence-team'));
$this->assertSame(RoomType::OpenPresence, RoomType::fromName('open-presence-town-hall'));
}
public function test_auth_and_presence_flags(): void
{
$this->assertTrue(RoomType::Private->requiresAuth());
$this->assertTrue(RoomType::Presence->requiresAuth());
$this->assertFalse(RoomType::Public->requiresAuth());
$this->assertFalse(RoomType::OpenPresence->requiresAuth());
$this->assertTrue(RoomType::Presence->hasPresence());
$this->assertTrue(RoomType::OpenPresence->hasPresence());
$this->assertFalse(RoomType::Public->hasPresence());
$this->assertFalse(RoomType::Private->hasPresence());
}
}