|
27 | 27 | use BigBlueButton\Http\Transport\TransportResponse; |
28 | 28 | use BigBlueButton\Parameters\DeleteRecordingsParameters; |
29 | 29 | use BigBlueButton\Parameters\GetRecordingsParameters; |
| 30 | +use BigBlueButton\Parameters\GetRecordingTextTracksParameters; |
30 | 31 | use BigBlueButton\Parameters\InsertDocumentParameters; |
31 | 32 | use BigBlueButton\Parameters\PublishRecordingsParameters; |
| 33 | +use BigBlueButton\Parameters\PutRecordingTextTrackParameters; |
32 | 34 | use PHPUnit\Framework\MockObject\MockObject; |
33 | 35 |
|
34 | 36 | /** |
@@ -372,4 +374,77 @@ public function testGetInsertDocument(): void |
372 | 374 |
|
373 | 375 | $this->assertTrue($response->success()); |
374 | 376 | } |
| 377 | + |
| 378 | + public function testGetRecordingTextTracks(): void |
| 379 | + { |
| 380 | + $params = new GetRecordingTextTracksParameters('foobar'); |
| 381 | + |
| 382 | + $json = '{ |
| 383 | + "response": { |
| 384 | + "returncode": "SUCCESS", |
| 385 | + "tracks": [ |
| 386 | + { |
| 387 | + "href": "https://captions.example.com/textTrack/0ab39e419c9bcb63233168daefe390f232c71343/183f0bf3a0982a127bdb8161e0c44eb696b3e75c-1554230749920/subtitles_en-US.vtt", |
| 388 | + "kind": "subtitles", |
| 389 | + "label": "English", |
| 390 | + "lang": "en-US", |
| 391 | + "source": "upload" |
| 392 | + }, |
| 393 | + { |
| 394 | + "href": "https://captions.example.com/textTrack/95b62d1b762700b9d5366a9e71d5fcc5086f2723/183f0bf3a0982a127bdb8161e0c44eb696b3e75c-1554230749920/subtitles_pt-BR.vtt", |
| 395 | + "kind": "subtitles", |
| 396 | + "label": "Brazil", |
| 397 | + "lang": "pt-BR", |
| 398 | + "source": "upload" |
| 399 | + } |
| 400 | + ] |
| 401 | + } |
| 402 | + }'; |
| 403 | + $this->transport->method('request')->willReturn(new TransportResponse($json, null)); |
| 404 | + |
| 405 | + $response = $this->bbb->getRecordingTextTracks($params); |
| 406 | + |
| 407 | + $this->assertTrue($response->success()); |
| 408 | + $this->assertSame('SUCCESS', $response->getReturnCode()); |
| 409 | + |
| 410 | + $tracks = $response->getTracks(); |
| 411 | + $this->assertCount(2, $tracks); |
| 412 | + $this->assertArrayHasKey(0, $tracks); |
| 413 | + $this->assertArrayHasKey(1, $tracks); |
| 414 | + |
| 415 | + $this->assertSame('https://captions.example.com/textTrack/0ab39e419c9bcb63233168daefe390f232c71343/183f0bf3a0982a127bdb8161e0c44eb696b3e75c-1554230749920/subtitles_en-US.vtt', $tracks[0]->getHref()); |
| 416 | + $this->assertSame('subtitles', $tracks[0]->getKind()); |
| 417 | + $this->assertSame('English', $tracks[0]->getLabel()); |
| 418 | + $this->assertSame('en-US', $tracks[0]->getLang()); |
| 419 | + $this->assertSame('upload', $tracks[0]->getSource()); |
| 420 | + |
| 421 | + $this->assertSame('https://captions.example.com/textTrack/95b62d1b762700b9d5366a9e71d5fcc5086f2723/183f0bf3a0982a127bdb8161e0c44eb696b3e75c-1554230749920/subtitles_pt-BR.vtt', $tracks[1]->getHref()); |
| 422 | + $this->assertSame('subtitles', $tracks[1]->getKind()); |
| 423 | + $this->assertSame('Brazil', $tracks[1]->getLabel()); |
| 424 | + $this->assertSame('pt-BR', $tracks[1]->getLang()); |
| 425 | + $this->assertSame('upload', $tracks[1]->getSource()); |
| 426 | + } |
| 427 | + |
| 428 | + public function testPutRecordingTextTrack(): void |
| 429 | + { |
| 430 | + $params = new PutRecordingTextTrackParameters('foobar', 'subtitles', 'en-US', 'English'); |
| 431 | + |
| 432 | + $json = '{ |
| 433 | + "response": { |
| 434 | + "messageKey": "upload_text_track_success", |
| 435 | + "message": "Text track uploaded successfully", |
| 436 | + "recordId": "baz", |
| 437 | + "returncode": "SUCCESS" |
| 438 | + } |
| 439 | + }'; |
| 440 | + $this->transport->method('request')->willReturn(new TransportResponse($json, null)); |
| 441 | + |
| 442 | + $response = $this->bbb->putRecordingTextTrack($params); |
| 443 | + |
| 444 | + $this->assertTrue($response->success()); |
| 445 | + $this->assertNull($response->getMessageKey()); |
| 446 | + $this->assertNull($response->getMessage()); |
| 447 | + $this->assertSame('baz', $response->getRecordID()); |
| 448 | + $this->assertSame('SUCCESS', $response->getReturnCode()); |
| 449 | + } |
375 | 450 | } |
0 commit comments