Skip to content

Commit

Permalink
Merge branch 'master' into 157-functional-tests-failing
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelWei authored Oct 7, 2023
2 parents 879a20a + 7efb21c commit 1d4a0fa
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 38 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@
"brainmaestro/composer-git-hooks": "^2.8",
"extensions": {
"phpunit/phpunit": {
"fakerphp/faker": "^1.14"
"fakerphp/faker": "1.20.*"
}
},
"friendsofphp/php-cs-fixer": "^3.3",
"php-coveralls/php-coveralls": "^2.4",
"phpunit/phpunit": "^8",
"phpunit/phpunit": "^9",
"vimeo/psalm": "^4.22"
}
}
Expand Down
48 changes: 17 additions & 31 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,33 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>


<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="./tests/bootstrap.php"
colors="true"
convertDeprecationsToExceptions="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>

<testsuites>
<testsuite name="BigBlueButton unit test suite">
<directory>./tests/unit/</directory>
</testsuite>
<testsuite name="BigBlueButton integration test suite">
<directory>./tests/integration/</directory>
</testsuite>
<testsuite name="BigBlueButton functional test suite">
<directory>./tests/functional/</directory>
</testsuite>
</testsuites>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="./tests/bootstrap.php" colors="true" convertDeprecationsToExceptions="false" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="BigBlueButton unit test suite">
<directory>./tests/unit/</directory>
</testsuite>
<testsuite name="BigBlueButton integration test suite">
<directory>./tests/integration/</directory>
</testsuite>
<testsuite name="BigBlueButton functional test suite">
<directory>./tests/functional/</directory>
</testsuite>
</testsuites>
</phpunit>
2 changes: 1 addition & 1 deletion src/Parameters/CreateMeetingParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ public function getHTTPQuery(): string

if ($this->isBreakout()) {
if ($this->parentMeetingID === null || $this->sequence === null) {
trigger_error('Breakout rooms require a parentMeetingID and sequence number.', \E_USER_WARNING);
throw new \RuntimeException('Breakout rooms require a parentMeetingID and sequence number.');
}
} else {
$queries = $this->filterBreakoutRelatedQueries($queries);
Expand Down
75 changes: 75 additions & 0 deletions tests/unit/BigBlueButtonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
use BigBlueButton\Http\Transport\TransportResponse;
use BigBlueButton\Parameters\DeleteRecordingsParameters;
use BigBlueButton\Parameters\GetRecordingsParameters;
use BigBlueButton\Parameters\GetRecordingTextTracksParameters;
use BigBlueButton\Parameters\InsertDocumentParameters;
use BigBlueButton\Parameters\PublishRecordingsParameters;
use BigBlueButton\Parameters\PutRecordingTextTrackParameters;
use PHPUnit\Framework\MockObject\MockObject;

/**
Expand Down Expand Up @@ -372,4 +374,77 @@ public function testGetInsertDocument(): void

$this->assertTrue($response->success());
}

public function testGetRecordingTextTracks(): void
{
$params = new GetRecordingTextTracksParameters('foobar');

$json = '{
"response": {
"returncode": "SUCCESS",
"tracks": [
{
"href": "https://captions.example.com/textTrack/0ab39e419c9bcb63233168daefe390f232c71343/183f0bf3a0982a127bdb8161e0c44eb696b3e75c-1554230749920/subtitles_en-US.vtt",
"kind": "subtitles",
"label": "English",
"lang": "en-US",
"source": "upload"
},
{
"href": "https://captions.example.com/textTrack/95b62d1b762700b9d5366a9e71d5fcc5086f2723/183f0bf3a0982a127bdb8161e0c44eb696b3e75c-1554230749920/subtitles_pt-BR.vtt",
"kind": "subtitles",
"label": "Brazil",
"lang": "pt-BR",
"source": "upload"
}
]
}
}';
$this->transport->method('request')->willReturn(new TransportResponse($json, null));

$response = $this->bbb->getRecordingTextTracks($params);

$this->assertTrue($response->success());
$this->assertSame('SUCCESS', $response->getReturnCode());

$tracks = $response->getTracks();
$this->assertCount(2, $tracks);
$this->assertArrayHasKey(0, $tracks);
$this->assertArrayHasKey(1, $tracks);

$this->assertSame('https://captions.example.com/textTrack/0ab39e419c9bcb63233168daefe390f232c71343/183f0bf3a0982a127bdb8161e0c44eb696b3e75c-1554230749920/subtitles_en-US.vtt', $tracks[0]->getHref());
$this->assertSame('subtitles', $tracks[0]->getKind());
$this->assertSame('English', $tracks[0]->getLabel());
$this->assertSame('en-US', $tracks[0]->getLang());
$this->assertSame('upload', $tracks[0]->getSource());

$this->assertSame('https://captions.example.com/textTrack/95b62d1b762700b9d5366a9e71d5fcc5086f2723/183f0bf3a0982a127bdb8161e0c44eb696b3e75c-1554230749920/subtitles_pt-BR.vtt', $tracks[1]->getHref());
$this->assertSame('subtitles', $tracks[1]->getKind());
$this->assertSame('Brazil', $tracks[1]->getLabel());
$this->assertSame('pt-BR', $tracks[1]->getLang());
$this->assertSame('upload', $tracks[1]->getSource());
}

public function testPutRecordingTextTrack(): void
{
$params = new PutRecordingTextTrackParameters('foobar', 'subtitles', 'en-US', 'English');

$json = '{
"response": {
"messageKey": "upload_text_track_success",
"message": "Text track uploaded successfully",
"recordId": "baz",
"returncode": "SUCCESS"
}
}';
$this->transport->method('request')->willReturn(new TransportResponse($json, null));

$response = $this->bbb->putRecordingTextTrack($params);

$this->assertTrue($response->success());
$this->assertNull($response->getMessageKey());
$this->assertNull($response->getMessage());
$this->assertSame('baz', $response->getRecordID());
$this->assertSame('SUCCESS', $response->getReturnCode());
}
}
3 changes: 1 addition & 2 deletions tests/unit/Parameters/CreateMeetingParametersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

use BigBlueButton\Core\GuestPolicy;
use BigBlueButton\TestCase;
use PHPUnit\Framework\Error\Warning;

/**
* Class CreateMeetingParametersTest.
Expand Down Expand Up @@ -123,7 +122,7 @@ public function testCreateBreakoutMeeting()

public function testCreateBreakoutMeetingWithMissingParams()
{
$this->expectException(Warning::class);
$this->expectException(\RuntimeException::class);

$params = new CreateMeetingParameters($this->faker->uuid, $this->faker->name);
$params->setBreakout(true);
Expand Down
4 changes: 2 additions & 2 deletions tools/.phpunit/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"phpunit/phpunit": "^8",
"fakerphp/faker": "^1.14"
"phpunit/phpunit": "^9.0",
"fakerphp/faker": "1.20.*"
}
}

0 comments on commit 1d4a0fa

Please sign in to comment.