diff --git a/.travis.yml b/.travis.yml index 4f0a7a86..bd904d76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,9 @@ php: - 5.6 - 7.0 - 7.1 -- hhvm +- hhvm-3.30 before_script: +- curl -sSfL -o ~/.phpenv/versions/hhvm/bin/phpunit https://phar.phpunit.de/phpunit-5.7.phar - travis_retry composer install script: - ./vendor/bin/phpunit diff --git a/src/OpenTok/StreamList.php b/src/OpenTok/StreamList.php index 62be7ee0..5a78f5df 100644 --- a/src/OpenTok/StreamList.php +++ b/src/OpenTok/StreamList.php @@ -3,14 +3,17 @@ namespace OpenTok; /** -* An object, returned by the OpenTok.listStreams() -* method, representing a list of streams in an OpenTok session. -*/ -class StreamList { - - /** @ignore */ + * An object, returned by the OpenTok.listStreams() + * method, representing a list of streams in an OpenTok session. + */ +class StreamList +{ + /** @ignore */ private $data; + /** @ignore */ + private $items; + /** @ignore */ public function __construct($streamListData) { @@ -19,6 +22,8 @@ public function __construct($streamListData) /** * Returns the number of total streams for the session ID. + * + * @return int */ public function totalCount() { @@ -27,12 +32,14 @@ public function totalCount() /** * Returns an array of Stream objects. + * + * @return array */ public function getItems() { - if (!$this->items) { + if (!is_array($this->items)) { $items = array(); - foreach($this->data['items'] as $streamData) { + foreach ($this->data['items'] as $streamData) { $items[] = new Stream($streamData); } $this->items = $items; @@ -40,7 +47,9 @@ public function getItems() return $this->items; } - + /** + * @return array + */ public function jsonSerialize() { return $this->data; diff --git a/src/OpenTok/Util/Client.php b/src/OpenTok/Util/Client.php index 365cb314..4c8236a5 100755 --- a/src/OpenTok/Util/Client.php +++ b/src/OpenTok/Util/Client.php @@ -38,7 +38,7 @@ // TODO: build this dynamically /** @internal */ -define('OPENTOK_SDK_VERSION', '4.4.0'); +define('OPENTOK_SDK_VERSION', '4.4.1'); /** @internal */ define('OPENTOK_SDK_USER_AGENT', 'OpenTok-PHP-SDK/' . OPENTOK_SDK_VERSION); diff --git a/tests/OpenTok/ArchiveTest.php b/tests/OpenTok/ArchiveTest.php index 3cafb4c2..13895042 100644 --- a/tests/OpenTok/ArchiveTest.php +++ b/tests/OpenTok/ArchiveTest.php @@ -156,7 +156,7 @@ public function testStopsArchive() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); // TODO: test the properties of the actual archive object $this->assertEquals('stopped', $this->archive->status); @@ -195,7 +195,7 @@ public function testDeletesArchive() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $this->assertTrue($success); // TODO: assert that all properties of the archive object were cleared diff --git a/tests/OpenTok/OpenTokTest.php b/tests/OpenTok/OpenTokTest.php index 59e80ce5..75655c58 100644 --- a/tests/OpenTok/OpenTokTest.php +++ b/tests/OpenTok/OpenTokTest.php @@ -126,7 +126,7 @@ public function testCreatesDefaultSession() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $p2p_preference = $this->getPostField($request, 'p2p.preference'); $this->assertEquals('enabled', $p2p_preference); @@ -186,7 +186,7 @@ public function testCreatesMediaRoutedAndLocationSession() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $location = $this->getPostField($request, 'location'); $this->assertEquals('12.34.56.78', $location); @@ -234,7 +234,7 @@ public function testCreatesMediaRelayedSession() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $p2p_preference = $this->getPostField($request, 'p2p.preference'); $this->assertEquals('enabled', $p2p_preference); @@ -279,7 +279,7 @@ public function testCreatesAutoArchivedSession() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $archiveMode = $this->getPostField($request, 'archiveMode'); $this->assertEquals('always', $archiveMode); @@ -521,7 +521,7 @@ public function testStartsArchive() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $this->assertInstanceOf('OpenTok\Archive', $archive); $this->assertEquals(0, $archive->duration); @@ -571,7 +571,7 @@ public function testStartsArchiveNamed() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $body = json_decode($request->getBody()); $this->assertEquals($sessionId, $body->sessionId); @@ -619,7 +619,7 @@ public function testStartsArchiveNamedDeprecated() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $body = json_decode($request->getBody()); $this->assertEquals($sessionId, $body->sessionId); @@ -666,7 +666,7 @@ public function testStartsArchiveAudioOnly() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $body = json_decode($request->getBody()); $this->assertEquals($sessionId, $body->sessionId); @@ -716,7 +716,7 @@ public function testStartsArchiveIndividualOutput() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $body = json_decode($request->getBody()); $this->assertEquals($sessionId, $body->sessionId); @@ -765,7 +765,7 @@ public function testStartsArchiveResolutionSD() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $body = json_decode($request->getBody()); $this->assertEquals($sessionId, $body->sessionId); @@ -813,7 +813,7 @@ public function testStartsArchiveResolutionHD() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $body = json_decode($request->getBody()); $this->assertEquals($sessionId, $body->sessionId); @@ -857,7 +857,7 @@ public function testStopsArchive() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $this->assertInstanceOf('OpenTok\Archive', $archive); // TODO: test the properties of the actual archive object @@ -896,7 +896,7 @@ public function testGetsArchive() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $this->assertInstanceOf('OpenTok\Archive', $archive); // TODO: test the properties of the actual archive object @@ -933,7 +933,7 @@ public function testDeletesArchive() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $this->assertTrue($success); // TODO: test the properties of the actual archive object @@ -968,7 +968,7 @@ public function testListsArchives() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $this->assertInstanceOf('OpenTok\ArchiveList', $archiveList); // TODO: test the properties of the actual archiveList object and its contained archive @@ -1004,7 +1004,7 @@ public function testListsArchivesWithOffsetAndCount() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $this->assertInstanceOf('OpenTok\ArchiveList', $archiveList); $this->assertEquals(1, $archiveList->totalCount()); @@ -1045,7 +1045,7 @@ public function testListsArchivesWithSessionId() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $this->assertInstanceOf('OpenTok\ArchiveList', $archiveList); $this->assertEquals(2, $archiveList->totalCount()); @@ -1131,7 +1131,7 @@ public function testForceDisconnect() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $this->assertTrue($success); } @@ -1192,7 +1192,7 @@ public function testStartsBroadcast() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $this->assertInstanceOf('OpenTok\Broadcast', $broadcast); $this->assertInternalType('string', $broadcast->id); @@ -1248,7 +1248,7 @@ public function testStartBroadcastWithOptions() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $this->assertInstanceOf('OpenTok\Broadcast', $broadcast); $this->assertInternalType('string', $broadcast->id); @@ -1295,7 +1295,7 @@ public function testStopsBroadcast() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $this->assertInstanceOf('OpenTok\Broadcast', $broadcast); $this->assertTrue($broadcast->isStopped); @@ -1332,7 +1332,7 @@ public function testGetsBroadcast() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $this->assertInstanceOf('OpenTok\Broadcast', $broadcast); } @@ -1376,7 +1376,7 @@ public function testUpdatesBroadcastLayoutWithPredefined() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); } public function testUpdatesBroadcastLayoutWithCustom() @@ -1422,7 +1422,7 @@ public function testUpdatesBroadcastLayoutWithCustom() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); } public function testUpdatesStreamLayoutClassList() @@ -1467,7 +1467,7 @@ public function testUpdatesStreamLayoutClassList() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); } public function testGetStream() @@ -1506,7 +1506,7 @@ public function testGetStream() $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); } public function testSipCall() @@ -1674,7 +1674,7 @@ public function testSignalData() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $body = json_decode($request->getBody()); $this->assertEquals('apple', $body->data); @@ -1716,7 +1716,7 @@ public function testSignalWithConnectionId() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $body = json_decode($request->getBody()); $this->assertEquals('random message', $body->data); @@ -1827,7 +1827,7 @@ public function testListStreams() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); $this->assertInstanceOf('OpenTok\StreamList', $streamList); @@ -1871,7 +1871,7 @@ public function testsSetArchiveLayoutWithPredefined() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); } public function testsSetArchiveLayoutWithCustom() @@ -1917,7 +1917,7 @@ public function testsSetArchiveLayoutWithCustom() // TODO: test the dynamically built User Agent string $userAgent = $request->getHeaderLine('User-Agent'); $this->assertNotEmpty($userAgent); - $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.0', $userAgent); + $this->assertStringStartsWith('OpenTok-PHP-SDK/4.4.1', $userAgent); } }