Skip to content

Commit 13ff02d

Browse files
committed
push codecov
1 parent d09ed9c commit 13ff02d

File tree

2 files changed

+59
-14
lines changed

2 files changed

+59
-14
lines changed

tests/OpenTokTest/BroadcastTest.php

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,22 @@
1313

1414
class BroadcastTest extends TestCase
1515
{
16-
17-
protected $broadcastData;
1816
protected $API_KEY;
1917
protected $API_SECRET;
2018

2119
protected $broadcast;
20+
protected $broadcastData;
2221
protected $client;
2322

2423
protected static $mockBasePath;
24+
/**
25+
* @var array
26+
*/
27+
private $historyContainer;
2528

26-
public static function setUpBeforeClass(): void
27-
{
28-
self::$mockBasePath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'mock' . DIRECTORY_SEPARATOR;
29-
}
30-
31-
public function setupBroadcasts($streamMode)
29+
public function setUp(): void
3230
{
33-
// Set up fixtures
34-
$this->broadcastData = array(
31+
$this->broadcastData = [
3532
'id' => '063e72a4-64b4-43c8-9da5-eca071daab89',
3633
'createdAt' => 1394394801000,
3734
'updatedAt' => 1394394801000,
@@ -40,16 +37,27 @@ public function setupBroadcasts($streamMode)
4037
'layout' => [
4138
'type' => 'custom',
4239
'stylesheet' => 'a layout stylesheet',
43-
'streenshareType' => 'some options'
40+
'screenshareType' => 'some options'
4441
],
4542
'maxDuration' => 5400,
4643
'resolution' => '640x480',
47-
'streamMode' => $streamMode,
44+
'streamMode' => StreamMode::AUTO,
4845
'isAudio' => true,
4946
'isVideo' => true
50-
);
47+
];
48+
}
5149

52-
$this->broadcast = new Broadcast($this->broadcastData, array(
50+
public static function setUpBeforeClass(): void
51+
{
52+
self::$mockBasePath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'mock' . DIRECTORY_SEPARATOR;
53+
}
54+
55+
public function setupBroadcasts($streamMode)
56+
{
57+
$data = $this->broadcastData;
58+
$data['streamMode'] = $streamMode;
59+
60+
$this->broadcast = new Broadcast($data, array(
5361
'apiKey' => $this->API_KEY,
5462
'apiSecret' => $this->API_SECRET,
5563
'client' => $this->client
@@ -88,6 +96,39 @@ private function setupOTWithMocks($mocks)
8896
$handlerStack->push($history);
8997
}
9098

99+
public function testCannotCreateBroadcastWithAddInvalidApiKey(): void
100+
{
101+
$this->expectException(InvalidArgumentException::class);
102+
$this->expectExceptionMessage('The apiKey was not a string nor an integer: ');
103+
104+
$broadcastObject = new Broadcast($this->broadcastData, [
105+
'apiKey' => new Client()
106+
]);
107+
}
108+
109+
public function testCannotCreateBroadcastWithInvalidApiSecret(): void
110+
{
111+
$this->expectException(InvalidArgumentException::class);
112+
$this->expectExceptionMessage('The apiSecret was not a string: OpenTok\Util\Client Object');
113+
114+
$broadcastObject = new Broadcast($this->broadcastData, [
115+
'apiKey' => 'test',
116+
'apiSecret' => new Client()
117+
]);
118+
}
119+
120+
public function testCannotCreateBroadcastWithInvalidApiUrl(): void
121+
{
122+
$this->expectException(InvalidArgumentException::class);
123+
$this->expectExceptionMessage('The optional apiUrl was not a string: ');
124+
125+
$broadcastObject = new Broadcast($this->broadcastData, [
126+
'apiKey' => 'validKey',
127+
'apiSecret' => 'validSecret',
128+
'apiUrl' => 'test'
129+
]);
130+
}
131+
91132
private function setupOT()
92133
{
93134
return $this->setupOTWithMocks([]);

tests/OpenTokTest/OpenTokTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ class OpenTokTest extends TestCase
3333
protected $client;
3434

3535
protected static $mockBasePath;
36+
/**
37+
* @var array
38+
*/
39+
private $historyContainer;
3640

3741
public static function setUpBeforeClass(): void
3842
{

0 commit comments

Comments
 (0)