@@ -124,7 +124,7 @@ public function testCreatesDefaultSession()
124124 // TODO: test the dynamically built User Agent string
125125 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
126126 $ this ->assertNotEmpty ($ userAgent );
127- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
127+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
128128
129129 $ p2p_preference = $ this ->getPostField ($ request , 'p2p.preference ' );
130130 $ this ->assertEquals ('enabled ' , $ p2p_preference );
@@ -184,7 +184,7 @@ public function testCreatesMediaRoutedAndLocationSession()
184184 // TODO: test the dynamically built User Agent string
185185 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
186186 $ this ->assertNotEmpty ($ userAgent );
187- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
187+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
188188
189189 $ location = $ this ->getPostField ($ request , 'location ' );
190190 $ this ->assertEquals ('12.34.56.78 ' , $ location );
@@ -232,7 +232,7 @@ public function testCreatesMediaRelayedSession()
232232 // TODO: test the dynamically built User Agent string
233233 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
234234 $ this ->assertNotEmpty ($ userAgent );
235- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
235+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
236236
237237 $ p2p_preference = $ this ->getPostField ($ request , 'p2p.preference ' );
238238 $ this ->assertEquals ('enabled ' , $ p2p_preference );
@@ -277,7 +277,7 @@ public function testCreatesAutoArchivedSession()
277277 // TODO: test the dynamically built User Agent string
278278 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
279279 $ this ->assertNotEmpty ($ userAgent );
280- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
280+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
281281
282282 $ archiveMode = $ this ->getPostField ($ request , 'archiveMode ' );
283283 $ this ->assertEquals ('always ' , $ archiveMode );
@@ -483,7 +483,7 @@ public function testStartsArchive()
483483 // TODO: test the dynamically built User Agent string
484484 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
485485 $ this ->assertNotEmpty ($ userAgent );
486- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
486+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
487487
488488 $ this ->assertInstanceOf ('OpenTok\Archive ' , $ archive );
489489 $ this ->assertEquals (0 , $ archive ->duration );
@@ -533,7 +533,7 @@ public function testStartsArchiveNamed()
533533 // TODO: test the dynamically built User Agent string
534534 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
535535 $ this ->assertNotEmpty ($ userAgent );
536- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
536+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
537537
538538 $ body = json_decode ($ request ->getBody ());
539539 $ this ->assertEquals ($ sessionId , $ body ->sessionId );
@@ -581,7 +581,7 @@ public function testStartsArchiveNamedDeprecated()
581581 // TODO: test the dynamically built User Agent string
582582 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
583583 $ this ->assertNotEmpty ($ userAgent );
584- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
584+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
585585
586586 $ body = json_decode ($ request ->getBody ());
587587 $ this ->assertEquals ($ sessionId , $ body ->sessionId );
@@ -628,7 +628,7 @@ public function testStartsArchiveAudioOnly()
628628 // TODO: test the dynamically built User Agent string
629629 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
630630 $ this ->assertNotEmpty ($ userAgent );
631- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
631+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
632632
633633 $ body = json_decode ($ request ->getBody ());
634634 $ this ->assertEquals ($ sessionId , $ body ->sessionId );
@@ -678,7 +678,7 @@ public function testStartsArchiveIndividualOutput()
678678 // TODO: test the dynamically built User Agent string
679679 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
680680 $ this ->assertNotEmpty ($ userAgent );
681- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
681+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
682682
683683 $ body = json_decode ($ request ->getBody ());
684684 $ this ->assertEquals ($ sessionId , $ body ->sessionId );
@@ -688,6 +688,102 @@ public function testStartsArchiveIndividualOutput()
688688 $ this ->assertEquals (OutputMode::INDIVIDUAL , $ archive ->outputMode );
689689 }
690690
691+ public function testStartsArchiveResolutionSD ()
692+ {
693+ // Arrange
694+ $ this ->setupOTWithMocks ([[
695+ 'code ' => 200 ,
696+ 'headers ' => [
697+ 'Content-Type ' => 'application/json '
698+ ],
699+ 'path ' => 'v2/project/APIKEY/archive/session_resolution-sd '
700+ ]]);
701+
702+ // This sessionId was generated using a different apiKey, but this method doesn't do any
703+ // decoding to check, so its fine.
704+ $ sessionId = '2_MX44NTQ1MTF-flR1ZSBOb3YgMTIgMDk6NDA6NTkgUFNUIDIwMTN-MC43NjU0Nzh- ' ;
705+
706+ // Act
707+ $ archive = $ this ->opentok ->startArchive ($ sessionId , array (
708+ 'resolution ' => '640x480 '
709+ ));
710+
711+ // Assert
712+ $ this ->assertCount (1 , $ this ->historyContainer );
713+
714+ $ request = $ this ->historyContainer [0 ]['request ' ];
715+ $ this ->assertEquals ('POST ' , strtoupper ($ request ->getMethod ()));
716+ $ this ->assertEquals ('/v2/project/ ' .$ this ->API_KEY .'/archive ' , $ request ->getUri ()->getPath ());
717+ $ this ->assertEquals ('api.opentok.com ' , $ request ->getUri ()->getHost ());
718+ $ this ->assertEquals ('https ' , $ request ->getUri ()->getScheme ());
719+
720+ $ contentType = $ request ->getHeaderLine ('Content-Type ' );
721+ $ this ->assertNotEmpty ($ contentType );
722+ $ this ->assertEquals ('application/json ' , $ contentType );
723+
724+ $ authString = $ request ->getHeaderLine ('X-OPENTOK-AUTH ' );
725+ $ this ->assertEquals (true , TestHelpers::validateOpenTokAuthHeader ($ this ->API_KEY , $ this ->API_SECRET , $ authString ));
726+
727+ // TODO: test the dynamically built User Agent string
728+ $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
729+ $ this ->assertNotEmpty ($ userAgent );
730+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
731+
732+ $ body = json_decode ($ request ->getBody ());
733+ $ this ->assertEquals ($ sessionId , $ body ->sessionId );
734+ $ this ->assertEquals ('640x480 ' , $ body ->resolution );
735+
736+ $ this ->assertInstanceOf ('OpenTok\Archive ' , $ archive );
737+ }
738+
739+ public function testStartsArchiveResolutionHD ()
740+ {
741+ // Arrange
742+ $ this ->setupOTWithMocks ([[
743+ 'code ' => 200 ,
744+ 'headers ' => [
745+ 'Content-Type ' => 'application/json '
746+ ],
747+ 'path ' => 'v2/project/APIKEY/archive/session_resolution-hd '
748+ ]]);
749+
750+ // This sessionId was generated using a different apiKey, but this method doesn't do any
751+ // decoding to check, so its fine.
752+ $ sessionId = '2_MX44NTQ1MTF-flR1ZSBOb3YgMTIgMDk6NDA6NTkgUFNUIDIwMTN-MC43NjU0Nzh- ' ;
753+
754+ // Act
755+ $ archive = $ this ->opentok ->startArchive ($ sessionId , array (
756+ 'resolution ' => '1280x720 '
757+ ));
758+
759+ // Assert
760+ $ this ->assertCount (1 , $ this ->historyContainer );
761+
762+ $ request = $ this ->historyContainer [0 ]['request ' ];
763+ $ this ->assertEquals ('POST ' , strtoupper ($ request ->getMethod ()));
764+ $ this ->assertEquals ('/v2/project/ ' .$ this ->API_KEY .'/archive ' , $ request ->getUri ()->getPath ());
765+ $ this ->assertEquals ('api.opentok.com ' , $ request ->getUri ()->getHost ());
766+ $ this ->assertEquals ('https ' , $ request ->getUri ()->getScheme ());
767+
768+ $ contentType = $ request ->getHeaderLine ('Content-Type ' );
769+ $ this ->assertNotEmpty ($ contentType );
770+ $ this ->assertEquals ('application/json ' , $ contentType );
771+
772+ $ authString = $ request ->getHeaderLine ('X-OPENTOK-AUTH ' );
773+ $ this ->assertEquals (true , TestHelpers::validateOpenTokAuthHeader ($ this ->API_KEY , $ this ->API_SECRET , $ authString ));
774+
775+ // TODO: test the dynamically built User Agent string
776+ $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
777+ $ this ->assertNotEmpty ($ userAgent );
778+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
779+
780+ $ body = json_decode ($ request ->getBody ());
781+ $ this ->assertEquals ($ sessionId , $ body ->sessionId );
782+ $ this ->assertEquals ('1280x720 ' , $ body ->resolution );
783+
784+ $ this ->assertInstanceOf ('OpenTok\Archive ' , $ archive );
785+ }
786+
691787 public function testStopsArchive ()
692788 {
693789 // Arrange
@@ -723,7 +819,7 @@ public function testStopsArchive()
723819 // TODO: test the dynamically built User Agent string
724820 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
725821 $ this ->assertNotEmpty ($ userAgent );
726- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
822+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
727823
728824 $ this ->assertInstanceOf ('OpenTok\Archive ' , $ archive );
729825 // TODO: test the properties of the actual archive object
@@ -762,7 +858,7 @@ public function testGetsArchive()
762858 // TODO: test the dynamically built User Agent string
763859 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
764860 $ this ->assertNotEmpty ($ userAgent );
765- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
861+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
766862
767863 $ this ->assertInstanceOf ('OpenTok\Archive ' , $ archive );
768864 // TODO: test the properties of the actual archive object
@@ -799,7 +895,7 @@ public function testDeletesArchive()
799895 // TODO: test the dynamically built User Agent string
800896 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
801897 $ this ->assertNotEmpty ($ userAgent );
802- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
898+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
803899
804900 $ this ->assertTrue ($ success );
805901 // TODO: test the properties of the actual archive object
@@ -834,7 +930,7 @@ public function testListsArchives()
834930 // TODO: test the dynamically built User Agent string
835931 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
836932 $ this ->assertNotEmpty ($ userAgent );
837- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
933+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
838934
839935 $ this ->assertInstanceOf ('OpenTok\ArchiveList ' , $ archiveList );
840936 // TODO: test the properties of the actual archiveList object and its contained archive
@@ -870,7 +966,7 @@ public function testListsArchivesWithOffsetAndCount()
870966 // TODO: test the dynamically built User Agent string
871967 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
872968 $ this ->assertNotEmpty ($ userAgent );
873- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
969+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
874970
875971 $ this ->assertInstanceOf ('OpenTok\ArchiveList ' , $ archiveList );
876972 $ this ->assertEquals (1 , $ archiveList ->totalCount ());
@@ -955,7 +1051,7 @@ public function testForceDisconnect()
9551051 // TODO: test the dynamically built User Agent string
9561052 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
9571053 $ this ->assertNotEmpty ($ userAgent );
958- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
1054+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
9591055
9601056 $ this ->assertTrue ($ success );
9611057 }
@@ -997,7 +1093,7 @@ public function testStartsBroadcast()
9971093 // TODO: test the dynamically built User Agent string
9981094 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
9991095 $ this ->assertNotEmpty ($ userAgent );
1000- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
1096+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
10011097
10021098 $ this ->assertInstanceOf ('OpenTok\Broadcast ' , $ broadcast );
10031099 $ this ->assertInternalType ('string ' , $ broadcast ->id );
@@ -1042,7 +1138,7 @@ public function testStopsBroadcast()
10421138 // TODO: test the dynamically built User Agent string
10431139 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
10441140 $ this ->assertNotEmpty ($ userAgent );
1045- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
1141+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
10461142
10471143 $ this ->assertInstanceOf ('OpenTok\Broadcast ' , $ broadcast );
10481144 $ this ->assertTrue ($ broadcast ->isStopped );
@@ -1079,7 +1175,7 @@ public function testGetsBroadcast()
10791175 // TODO: test the dynamically built User Agent string
10801176 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
10811177 $ this ->assertNotEmpty ($ userAgent );
1082- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
1178+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
10831179
10841180 $ this ->assertInstanceOf ('OpenTok\Broadcast ' , $ broadcast );
10851181 }
@@ -1123,7 +1219,7 @@ public function testUpdatesBroadcastLayoutWithPredefined()
11231219 // TODO: test the dynamically built User Agent string
11241220 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
11251221 $ this ->assertNotEmpty ($ userAgent );
1126- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
1222+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
11271223 }
11281224
11291225 public function testUpdatesBroadcastLayoutWithCustom ()
@@ -1169,7 +1265,7 @@ public function testUpdatesBroadcastLayoutWithCustom()
11691265 // TODO: test the dynamically built User Agent string
11701266 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
11711267 $ this ->assertNotEmpty ($ userAgent );
1172- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
1268+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
11731269 }
11741270
11751271 public function testUpdatesStreamLayoutClassList ()
@@ -1214,7 +1310,7 @@ public function testUpdatesStreamLayoutClassList()
12141310 // TODO: test the dynamically built User Agent string
12151311 $ userAgent = $ request ->getHeaderLine ('User-Agent ' );
12161312 $ this ->assertNotEmpty ($ userAgent );
1217- $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.0 ' , $ userAgent );
1313+ $ this ->assertStringStartsWith ('OpenTok-PHP-SDK/4.0.1-alpha.1 ' , $ userAgent );
12181314 }
12191315
12201316
0 commit comments