diff --git a/composer.json b/composer.json index e881bcdd..0d546020 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,11 @@ "name": "Ghazi Triki", "email": "ghazi.triki@riadvice.tn", "role": "Developer" + }, + { + "name": "Tim Korn", + "email": "korn@aufKurs.de", + "role": "Developer" } ], "repositories": { diff --git a/src/Parameters/DocumentableTrait.php b/src/Parameters/DocumentableTrait.php index 44b70258..6bd0de92 100644 --- a/src/Parameters/DocumentableTrait.php +++ b/src/Parameters/DocumentableTrait.php @@ -37,7 +37,7 @@ public function getPresentations(): array return $this->presentations; } - public function addPresentation(string $nameOrUrl, ?string $content = null, ?string $filename = null, DocumentOptions $documentOptions = null): self + public function addPresentation(string $nameOrUrl, ?string $content = null, ?string $filename = null, ?DocumentOptions $documentOptions = null): self { $this->presentations[$nameOrUrl] = [ 'content' => $content ? base64_encode($content) : null, @@ -58,6 +58,7 @@ public function getPresentationsAsXML(): string foreach ($this->presentations as $nameOrUrl => $data) { $presentation = $module->addChild('document'); + if (0 === mb_strpos($nameOrUrl, 'http')) { $presentation->addAttribute('url', $nameOrUrl); } else { @@ -89,4 +90,28 @@ public function getPresentationsAsXML(): string return $result; } + + private function urlExists(string $url): bool + { + $ch = curl_init($url); + + if (!$ch) { + throw new \RuntimeException('Unhandled curl error!'); + } + + curl_setopt($ch, CURLOPT_TIMEOUT, 5); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + $data = curl_exec($ch); + $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + + curl_close($ch); + + if ($httpCode >= 200 && $httpCode < 400) { + return true; + } + + return false; + } } diff --git a/tests/BigBlueButtonTest.php b/tests/BigBlueButtonTest.php index 57799876..57b15ba4 100644 --- a/tests/BigBlueButtonTest.php +++ b/tests/BigBlueButtonTest.php @@ -149,9 +149,11 @@ public function testCreateMeetingWithDocumentUrlAndFileName(): void */ public function testCreateMeetingWithDocumentEmbedded(): void { - $params = Fixtures::getCreateMeetingParametersMock(Fixtures::generateCreateParams()); + $content = file_get_contents(Fixtures::IMAGE_PATH . 'bbb_logo.png'); + $this->assertIsString($content); - $params->addPresentation('bbb_logo.png', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'bbb_logo.png')); + $params = Fixtures::getCreateMeetingParametersMock(Fixtures::generateCreateParams()); + $params->addPresentation('bbb_logo.png', $content); $result = $this->bbb->createMeeting($params); @@ -165,9 +167,12 @@ public function testCreateMeetingWithDocumentEmbedded(): void */ public function testCreateMeetingWithMultiDocument(): void { + $content = file_get_contents(Fixtures::IMAGE_PATH . 'bbb_logo.png'); + $this->assertIsString($content); + $params = Fixtures::getCreateMeetingParametersMock(Fixtures::generateCreateParams()); $params->addPresentation('https://picsum.photos/3840/2160/?random', null, 'presentation.png'); - $params->addPresentation('logo.png', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'bbb_logo.png')); + $params->addPresentation('logo.png', $content); $result = $this->bbb->createMeeting($params); diff --git a/tests/Parameters/CreateMeetingParametersTest.php b/tests/Parameters/CreateMeetingParametersTest.php index 55b0f77c..0ac56fba 100644 --- a/tests/Parameters/CreateMeetingParametersTest.php +++ b/tests/Parameters/CreateMeetingParametersTest.php @@ -133,21 +133,25 @@ public function testCreateBreakoutMeeting(): void public function testGetPresentationsAsXMLWithUrl(): void { $createMeetingParams = Fixtures::getCreateMeetingParametersMock(Fixtures::generateCreateParams()); - $createMeetingParams->addPresentation('http://test-install.blindsidenetworks.com/default.pdf'); - $this->assertXmlStringEqualsXmlFile(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'presentation_with_url.xml', $createMeetingParams->getPresentationsAsXML()); + $createMeetingParams->addPresentation('https://test-install.blindsidenetworks.com/default.pdf'); + $this->assertXmlStringEqualsXmlFile(Fixtures::REQUEST_PATH . 'presentation_with_url.xml', $createMeetingParams->getPresentationsAsXML()); } public function testGetPresentationsAsXMLWithUrlAndFilename(): void { $createMeetingParams = Fixtures::getCreateMeetingParametersMock(Fixtures::generateCreateParams()); - $createMeetingParams->addPresentation('http://test-install.blindsidenetworks.com/default.pdf', null, 'presentation.pdf'); - $this->assertXmlStringEqualsXmlFile(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'presentation_with_filename.xml', $createMeetingParams->getPresentationsAsXML()); + $createMeetingParams->addPresentation('https://test-install.blindsidenetworks.com/default.pdf', null, 'presentation.pdf'); + $this->assertXmlStringEqualsXmlFile(Fixtures::REQUEST_PATH . 'presentation_with_filename.xml', $createMeetingParams->getPresentationsAsXML()); } public function testGetPresentationsAsXMLWithFile(): void { + $content = file_get_contents(Fixtures::IMAGE_PATH . 'bbb_logo.png'); + $this->assertIsString($content); + $createMeetingParams = Fixtures::getCreateMeetingParametersMock(Fixtures::generateCreateParams()); - $createMeetingParams->addPresentation('bbb_logo.png', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'bbb_logo.png')); - $this->assertXmlStringEqualsXmlFile(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'presentation_with_embedded_file.xml', $createMeetingParams->getPresentationsAsXML()); + $createMeetingParams->addPresentation('bbb_logo.png', $content); + + $this->assertXmlStringEqualsXmlFile(Fixtures::REQUEST_PATH . 'presentation_with_embedded_file.xml', $createMeetingParams->getPresentationsAsXML()); } } diff --git a/tests/Parameters/InsertDocumentParametersTest.php b/tests/Parameters/InsertDocumentParametersTest.php index b9a36cdd..94c9cfb2 100644 --- a/tests/Parameters/InsertDocumentParametersTest.php +++ b/tests/Parameters/InsertDocumentParametersTest.php @@ -25,6 +25,7 @@ use BigBlueButton\Enum\DocumentOption; use BigBlueButton\Parameters\Config\DocumentOptions; use BigBlueButton\TestCase; +use BigBlueButton\TestServices\Fixtures; /** * @internal @@ -33,16 +34,22 @@ final class InsertDocumentParametersTest extends TestCase { public function testInsertDocumentParameters(): void { - $meetingId = $this->faker->uuid; - $params = new InsertDocumentParameters($meetingId); + $meetingId = $this->faker->uuid; + $insertDocumentParameters = new InsertDocumentParameters($meetingId); - $params->addPresentation('https://demo.bigbluebutton.org/biglbuebutton.png'); - $params->addPresentation('https://demo.bigbluebutton.org/biglbuebutton.pdf'); - $params->addPresentation('https://demo.bigbluebutton.org/biglbuebutton.svg'); + $insertDocumentParameters + ->addPresentation('https://freetestdata.com/wp-content/uploads/2021/09/Free_Test_Data_100KB_PDF.pdf') + ->addPresentation('https://freetestdata.com/wp-content/uploads/2022/02/Free_Test_Data_117KB_JPG.jpg') + ->addPresentation('https://freetestdata.com/wp-content/uploads/2021/09/500kb.png') + ->addPresentation('https://freetestdata.com/wp-content/uploads/2021/09/1.svg') + ; - $this->assertEquals($meetingId, $params->getMeetingID()); + $this->assertEquals($meetingId, $insertDocumentParameters->getMeetingID()); - $this->assertXmlStringEqualsXmlFile(dirname(__DIR__) . \DIRECTORY_SEPARATOR . 'fixtures' . \DIRECTORY_SEPARATOR . 'insert_document_presentations.xml', $params->getPresentationsAsXML()); + $this->assertXmlStringEqualsXmlFile( + Fixtures::REQUEST_PATH . 'insert_document_presentations.xml', + $insertDocumentParameters->getPresentationsAsXML() + ); } public function testInsertDocumentWithOptions(): void @@ -61,7 +68,9 @@ public function testInsertDocumentWithOptions(): void $this->assertEquals($meetingId, $insertDocumentParameters->getMeetingID()); - $file = dirname(__DIR__) . \DIRECTORY_SEPARATOR . 'fixtures' . \DIRECTORY_SEPARATOR . 'insert_document_presentations_with_options.xml'; - $this->assertXmlStringEqualsXmlFile($file, $insertDocumentParameters->getPresentationsAsXML()); + $this->assertXmlStringEqualsXmlFile( + Fixtures::REQUEST_PATH . 'insert_document_presentations_with_options.xml', + $insertDocumentParameters->getPresentationsAsXML() + ); } } diff --git a/tests/Responses/HooksCreateResponseTest.php b/tests/Responses/HooksCreateResponseTest.php index df9cc097..89c0400f 100644 --- a/tests/Responses/HooksCreateResponseTest.php +++ b/tests/Responses/HooksCreateResponseTest.php @@ -29,9 +29,8 @@ class HooksCreateResponseTest extends TestCase { private HooksCreateResponse $createResponseCreate; - private HooksCreateResponse $createResponseError; - private HooksCreateResponse $createResponseExisting; - private HooksCreateResponse $createResponseNoHookId; + private HooksCreateResponse $createResponseFailedError; + private HooksCreateResponse $createResponseCreateExisting; public function setUp(): void { @@ -39,15 +38,13 @@ public function setUp(): void $fixtures = new Fixtures(); - $xmlCreate = $fixtures->fromXmlFile('hooks_create.xml'); - $xmlCreateError = $fixtures->fromXmlFile('hooks_create_error.xml'); - $xmlCreateExisting = $fixtures->fromXmlFile('hooks_create_existing.xml'); - $xmlCreateNoHookId = $fixtures->fromXmlFile('hooks_create_no_hook_id.xml'); + $xmlCreate = $fixtures->fromXmlFile('hooks_create.xml'); + $xmlCreateExisting = $fixtures->fromXmlFile('hooks_create_existing.xml'); + $xmlCreateFailedError = $fixtures->fromXmlFile('hooks_create_failed_error.xml'); - $this->createResponseCreate = new HooksCreateResponse($xmlCreate); - $this->createResponseError = new HooksCreateResponse($xmlCreateError); - $this->createResponseExisting = new HooksCreateResponse($xmlCreateExisting); - $this->createResponseNoHookId = new HooksCreateResponse($xmlCreateNoHookId); + $this->createResponseCreate = new HooksCreateResponse($xmlCreate); + $this->createResponseCreateExisting = new HooksCreateResponse($xmlCreateExisting); + $this->createResponseFailedError = new HooksCreateResponse($xmlCreateFailedError); } public function testHooksCreateResponseCreateContent(): void @@ -63,35 +60,24 @@ public function testHooksCreateResponseCreateContent(): void public function testHooksCreateResponseErrorContent(): void { - $this->assertEquals('FAILED', $this->createResponseError->getReturnCode()); - $this->assertEquals('createHookError', $this->createResponseError->getMessageKey()); - $this->assertFalse($this->createResponseError->success()); - $this->assertTrue($this->createResponseError->failed()); - $this->assertNull($this->createResponseError->getHookId()); - $this->assertNull($this->createResponseError->isPermanentHook()); - $this->assertNull($this->createResponseError->hasRawData()); + $this->assertEquals('FAILED', $this->createResponseFailedError->getReturnCode()); + $this->assertEquals('createHookError', $this->createResponseFailedError->getMessageKey()); + $this->assertFalse($this->createResponseFailedError->success()); + $this->assertTrue($this->createResponseFailedError->failed()); + $this->assertNull($this->createResponseFailedError->getHookId()); + $this->assertNull($this->createResponseFailedError->isPermanentHook()); + $this->assertNull($this->createResponseFailedError->hasRawData()); } public function testHooksCreateResponseExistingContent(): void { - $this->assertEquals('SUCCESS', $this->createResponseExisting->getReturnCode()); - $this->assertEquals('duplicateWarning', $this->createResponseExisting->getMessageKey()); - $this->assertTrue($this->createResponseExisting->success()); - $this->assertFalse($this->createResponseExisting->failed()); - $this->assertEquals(1, $this->createResponseExisting->getHookId()); - $this->assertNull($this->createResponseExisting->isPermanentHook()); - $this->assertNull($this->createResponseExisting->hasRawData()); - } - - public function testHooksCreateResponseNoHookIdContent(): void - { - $this->assertEquals('FAILED', $this->createResponseNoHookId->getReturnCode()); - $this->assertEquals('missingParamHookID', $this->createResponseNoHookId->getMessageKey()); - $this->assertFalse($this->createResponseNoHookId->success()); - $this->assertTrue($this->createResponseNoHookId->failed()); - $this->assertNull($this->createResponseNoHookId->getHookId()); - $this->assertNull($this->createResponseNoHookId->isPermanentHook()); - $this->assertNull($this->createResponseNoHookId->hasRawData()); + $this->assertEquals('SUCCESS', $this->createResponseCreateExisting->getReturnCode()); + $this->assertEquals('duplicateWarning', $this->createResponseCreateExisting->getMessageKey()); + $this->assertTrue($this->createResponseCreateExisting->success()); + $this->assertFalse($this->createResponseCreateExisting->failed()); + $this->assertEquals(1, $this->createResponseCreateExisting->getHookId()); + $this->assertNull($this->createResponseCreateExisting->isPermanentHook()); + $this->assertNull($this->createResponseCreateExisting->hasRawData()); } public function testHooksCreateResponseTypes(): void @@ -100,14 +86,11 @@ public function testHooksCreateResponseTypes(): void $this->assertEachGetterValueIsInteger($this->createResponseCreate, ['getHookId']); $this->assertEachGetterValueIsBoolean($this->createResponseCreate, ['isPermanentHook', 'hasRawData']); - $this->assertEachGetterValueIsString($this->createResponseError, ['getReturnCode']); - $this->assertEachGetterValueIsNull($this->createResponseError, ['getHookId', 'isPermanentHook', 'hasRawData']); - - $this->assertEachGetterValueIsString($this->createResponseExisting, ['getReturnCode']); - $this->assertEachGetterValueIsInteger($this->createResponseExisting, ['getHookId']); - $this->assertEachGetterValueIsNull($this->createResponseExisting, ['isPermanentHook', 'hasRawData']); + $this->assertEachGetterValueIsString($this->createResponseFailedError, ['getReturnCode']); + $this->assertEachGetterValueIsNull($this->createResponseFailedError, ['getHookId', 'isPermanentHook', 'hasRawData']); - $this->assertEachGetterValueIsString($this->createResponseNoHookId, ['getReturnCode']); - $this->assertEachGetterValueIsNull($this->createResponseNoHookId, ['getHookId', 'isPermanentHook', 'hasRawData']); + $this->assertEachGetterValueIsString($this->createResponseCreateExisting, ['getReturnCode']); + $this->assertEachGetterValueIsInteger($this->createResponseCreateExisting, ['getHookId']); + $this->assertEachGetterValueIsNull($this->createResponseCreateExisting, ['isPermanentHook', 'hasRawData']); } } diff --git a/tests/Responses/HooksDestroyResponseTest.php b/tests/Responses/HooksDestroyResponseTest.php index 70593468..46f6a512 100644 --- a/tests/Responses/HooksDestroyResponseTest.php +++ b/tests/Responses/HooksDestroyResponseTest.php @@ -29,9 +29,9 @@ class HooksDestroyResponseTest extends TestCase { private HooksDestroyResponse $destroyResponse; - private HooksDestroyResponse $destroyResponseError; - private HooksDestroyResponse $destroyResponseNotFound; - private HooksDestroyResponse $destroyResponseParamsNoId; + private HooksDestroyResponse $destroyResponseFailedError; + private HooksDestroyResponse $destroyResponseFailedNotFound; + private HooksDestroyResponse $destroyResponseFailedNoId; public function setUp(): void { @@ -39,15 +39,15 @@ public function setUp(): void $fixtures = new Fixtures(); - $xml = $fixtures->fromXmlFile('hooks_destroy.xml'); - $xmlError = $fixtures->fromXmlFile('hooks_destroy_error.xml'); - $xmlNotFound = $fixtures->fromXmlFile('hooks_destroy_not_found.xml'); - $xmlParamsNoId = $fixtures->fromXmlFile('hooks_destroy_params_no_id.xml'); + $xml = $fixtures->fromXmlFile('hooks_destroy.xml'); + $xmlFailedError = $fixtures->fromXmlFile('hooks_destroy_failed_error.xml'); + $xmlFailedNoId = $fixtures->fromXmlFile('hooks_destroy_failed_no_id.xml'); + $xmlFailedNotFound = $fixtures->fromXmlFile('hooks_destroy_failed_not_found.xml'); - $this->destroyResponse = new HooksDestroyResponse($xml); - $this->destroyResponseError = new HooksDestroyResponse($xmlError); - $this->destroyResponseNotFound = new HooksDestroyResponse($xmlNotFound); - $this->destroyResponseParamsNoId = new HooksDestroyResponse($xmlParamsNoId); + $this->destroyResponse = new HooksDestroyResponse($xml); + $this->destroyResponseFailedError = new HooksDestroyResponse($xmlFailedError); + $this->destroyResponseFailedNoId = new HooksDestroyResponse($xmlFailedNoId); + $this->destroyResponseFailedNotFound = new HooksDestroyResponse($xmlFailedNotFound); } public function testHooksDestroyResponseContent(): void @@ -59,23 +59,23 @@ public function testHooksDestroyResponseContent(): void public function testHooksDestroyErrorResponseContent(): void { - $this->assertEquals('FAILED', $this->destroyResponseError->getReturnCode()); - $this->assertEquals('destroyHookError', $this->destroyResponseError->getMessageKey()); - $this->assertNull($this->destroyResponseError->removed()); + $this->assertEquals('FAILED', $this->destroyResponseFailedError->getReturnCode()); + $this->assertEquals('destroyHookError', $this->destroyResponseFailedError->getMessageKey()); + $this->assertNull($this->destroyResponseFailedError->removed()); } public function testHooksDestroyNotFoundResponseContent(): void { - $this->assertEquals('FAILED', $this->destroyResponseNotFound->getReturnCode()); - $this->assertEquals('destroyMissingHook', $this->destroyResponseNotFound->getMessageKey()); - $this->assertNull($this->destroyResponseNotFound->removed()); + $this->assertEquals('FAILED', $this->destroyResponseFailedNotFound->getReturnCode()); + $this->assertEquals('destroyMissingHook', $this->destroyResponseFailedNotFound->getMessageKey()); + $this->assertNull($this->destroyResponseFailedNotFound->removed()); } public function testHooksDestroyParamsNoIdContent(): void { - $this->assertEquals('FAILED', $this->destroyResponseParamsNoId->getReturnCode()); - $this->assertEquals('missingParamHookID', $this->destroyResponseParamsNoId->getMessageKey()); - $this->assertNull($this->destroyResponseParamsNoId->removed()); + $this->assertEquals('FAILED', $this->destroyResponseFailedNoId->getReturnCode()); + $this->assertEquals('missingParamHookID', $this->destroyResponseFailedNoId->getMessageKey()); + $this->assertNull($this->destroyResponseFailedNoId->removed()); } public function testHooksDestroyResponseTypes(): void @@ -83,13 +83,13 @@ public function testHooksDestroyResponseTypes(): void $this->assertEachGetterValueIsString($this->destroyResponse, ['getReturnCode']); $this->assertEachGetterValueIsBoolean($this->destroyResponse, ['removed']); - $this->assertEachGetterValueIsString($this->destroyResponseError, ['getReturnCode']); - $this->assertEachGetterValueIsNull($this->destroyResponseError, ['removed']); + $this->assertEachGetterValueIsString($this->destroyResponseFailedError, ['getReturnCode']); + $this->assertEachGetterValueIsNull($this->destroyResponseFailedError, ['removed']); - $this->assertEachGetterValueIsString($this->destroyResponseNotFound, ['getReturnCode']); - $this->assertEachGetterValueIsNull($this->destroyResponseNotFound, ['removed']); + $this->assertEachGetterValueIsString($this->destroyResponseFailedNotFound, ['getReturnCode']); + $this->assertEachGetterValueIsNull($this->destroyResponseFailedNotFound, ['removed']); - $this->assertEachGetterValueIsString($this->destroyResponseParamsNoId, ['getReturnCode']); - $this->assertEachGetterValueIsNull($this->destroyResponseParamsNoId, ['removed']); + $this->assertEachGetterValueIsString($this->destroyResponseFailedNoId, ['getReturnCode']); + $this->assertEachGetterValueIsNull($this->destroyResponseFailedNoId, ['removed']); } } diff --git a/tests/TestServices/Fixtures.php b/tests/TestServices/Fixtures.php index 5a5f3134..27775f62 100644 --- a/tests/TestServices/Fixtures.php +++ b/tests/TestServices/Fixtures.php @@ -32,12 +32,15 @@ class Fixtures { - public const PATH = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR; + public const RESPONSE_PATH = self::BASE_PATH . 'responses' . DIRECTORY_SEPARATOR; + public const REQUEST_PATH = self::BASE_PATH . 'requests' . DIRECTORY_SEPARATOR; + public const IMAGE_PATH = self::BASE_PATH . 'images' . DIRECTORY_SEPARATOR; + private const BASE_PATH = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR; // LOADERS --------------------------------------------------------------------------------------------------------- public static function fromXmlFile(string $filename): \SimpleXMLElement { - $uri = self::PATH . $filename; + $uri = self::RESPONSE_PATH . DIRECTORY_SEPARATOR . $filename; if (!file_exists($uri)) { throw new \RuntimeException("File '{$uri}' not found."); @@ -60,7 +63,7 @@ public static function fromXmlFile(string $filename): \SimpleXMLElement public static function fromJsonFile(string $filename): string { - $uri = self::PATH . $filename; + $uri = self::BASE_PATH . 'responses' . DIRECTORY_SEPARATOR . $filename; if (!file_exists($uri)) { throw new \RuntimeException("File '{$uri}' not found."); diff --git a/tests/Util/FixturesTest.php b/tests/Util/FixturesTest.php new file mode 100644 index 00000000..3c7e931d --- /dev/null +++ b/tests/Util/FixturesTest.php @@ -0,0 +1,641 @@ +. + */ + +namespace BigBlueButton\Util; + +use BigBlueButton\BigBlueButton; +use BigBlueButton\Core\Hook; +use BigBlueButton\Enum\Role; +use BigBlueButton\Parameters\CreateMeetingParameters; +use BigBlueButton\Parameters\EndMeetingParameters; +use BigBlueButton\Parameters\GetMeetingInfoParameters; +use BigBlueButton\Parameters\HooksCreateParameters; +use BigBlueButton\Parameters\HooksDestroyParameters; +use BigBlueButton\Parameters\InsertDocumentParameters; +use BigBlueButton\Parameters\IsMeetingRunningParameters; +use BigBlueButton\Parameters\JoinMeetingParameters; +use BigBlueButton\Responses\BaseResponse; +use BigBlueButton\TestServices\EnvLoader; +use BigBlueButton\TestServices\Fixtures; +use Faker\Factory as Faker; +use PHPUnit\Framework\TestCase; + +/** + * @internal + */ +class FixturesTest extends TestCase +{ + private BigBlueButton $bbb; + private Fixtures $fixtures; + + public function setUp(): void + { + parent::setUp(); + + EnvLoader::loadEnvironmentVariables(); + + $this->bbb = new BigBlueButton(); + $this->fixtures = new Fixtures(); + + // ensure server is clean (e.g. tearDown() has not been executed due to a previous failed tests) + $this->closeAllMeetings(); + $this->destroyAllHooks(); + } + + public function tearDown(): void + { + parent::tearDown(); + + $this->closeAllMeetings(); + $this->destroyAllHooks(); + } + + public function testCoverageOfFixtures(): void + { + // AS-IS: get all XML-file of the current test cases + $dataProvider = $this->xmlFileToFunctionMapping(); + $xmlFilenamesFromDataProvider = array_column($dataProvider, 'filename'); + + // TO-BE: get all XML-files of the fixtures-folder + $absolutePathnames = glob(Fixtures::RESPONSE_PATH . '*.xml'); + $this->assertIsArray($absolutePathnames); + $xmlFilenamesFromFolder = array_map(function($absolutePathname) { + return basename($absolutePathname); + }, $absolutePathnames); + $xmlFilesThatAreNotTestable = [ + 'hooks_destroy_failed_no_id.xml', // because: It is mandatory to have an id in the destroy constructor + 'hooks_destroy_failed_error.xml', // because: No idea how to simulate this on a well configured BBB-Server + 'hooks_create_failed_error.xml', // because: No idea how to simulate this on a well configured BBB-Server + ]; + $xmlFilenamesFromFolderCleaned = array_diff($xmlFilenamesFromFolder, $xmlFilesThatAreNotTestable); + + // COMPARE AS-IS AND TO-BE + $diff = array_diff($xmlFilenamesFromFolderCleaned, $xmlFilenamesFromDataProvider); + + if (!empty($diff)) { + self::markTestIncomplete("Not all XML-fixtures are checked regarding correctness:\n - " . implode("\n - ", $diff)); + } + } + + /** + * Background: A lot of the tests rely on the correctness of the data in the fixture files. If the fixture + * files are wrong the tests are not accurate. + * + * The purpose of this test is to determine whether the created fixture files still reflect accurately the + * response of the BBB-Server. It serves as an early indicator to determine if tests/functions need updates. + * + * @dataProvider xmlFileToFunctionMapping + */ + public function testStructureOfFixturesIsStillUpToDate(string $requestFunction, string $filename, bool $success, string $messageKey, ?\Closure $parameters): void + { + // get parameters by closure from data provider + $requestParameters = ($parameters) ? $parameters($this->bbb) : null; + + // make the request and get the XML of the response + /** @var BaseResponse $response */ + $response = $this->bbb->{$requestFunction}($requestParameters); + $xmlAsIs = $response->getRawXml(); + + // load the XML of the fixture + $xmlToBe = $this->fixtures->fromXmlFile($filename); + + $this->assertEquals($success, $response->success()); + $this->assertEquals($messageKey, $response->getMessageKey()); + $this->assertInstanceOf(\SimpleXMLElement::class, $xmlAsIs); + $this->assertInstanceOf(\SimpleXMLElement::class, $xmlToBe); + + /* + * There is a bug which prevent proper testing of the attendees. Once meetings are created on + * the server, you can join attendees, but by fetching the info of the meeting from the server + * the list of attendees is empty. So this needs to excluded temporary from the data that is + * coming from the fixture-files until that bug is solved. + * + * Remark: Once the bug is solved on the BBB-Server (= new Version), there must be a solution + * found to distinguish between versions prior and after the bug in order to keep the + * tests successful. + * + * @see https://github.com/bigbluebutton/bigbluebutton/issues/19767 + */ + if ( + 'get_meeting_info.xml' === $filename + || 'get_meeting_info_breakout_room.xml' === $filename + || 'get_meeting_info_with_breakout_rooms.xml' === $filename + ) { + unset($xmlToBe->attendees); // remove not empty node + $xmlToBe->addChild('attendees'); // add empty node + } + + $this->assertSameStructureOfXml($xmlToBe, $xmlAsIs); + } + + /** + * The data provider for the test above. + * + * @return array> + */ + private function xmlFileToFunctionMapping(): array + { + return [ + 'case01_api_version' => [ + 'function' => 'getApiVersion', + 'filename' => 'api_version.xml', + 'success' => true, + 'messageKey' => '', + 'parameters' => null, + ], + 'case02_create_meeting' => [ + 'function' => 'createMeeting', + 'filename' => 'create_meeting.xml', + 'success' => true, + 'messageKey' => '', + 'parameters' => function(BigBlueButton $bbb): CreateMeetingParameters { + $faker = Faker::create(); + + // create and return parameter for test + $createMeetingParameters = new CreateMeetingParameters(); + + return $createMeetingParameters + ->setMeetingId($faker->uuid) + ->setMeetingName('Meeting Room (case 02)') + ; + }, + ], + 'case03_join_meeting' => [ + 'function' => 'joinMeeting', + 'filename' => 'join_meeting.xml', + 'success' => true, + 'messageKey' => 'successfullyJoined', + 'parameters' => function(BigBlueButton $bbb): JoinMeetingParameters { + $faker = Faker::create(); + + // arrange the BBB-server + $createMeetingParameters = new CreateMeetingParameters($faker->uuid, 'Meeting Room (case 03)'); + $createMeetingResponse = $bbb->createMeeting($createMeetingParameters); + self::assertTrue($createMeetingResponse->success()); + self::assertEquals('bbb-none', $createMeetingResponse->getParentMeetingId()); + + // create and return parameter for test + $joinMeetingParameters = new JoinMeetingParameters(); + + return $joinMeetingParameters + ->setMeetingId($createMeetingResponse->getMeetingId()) + ->setCreationTime($createMeetingResponse->getCreationTime()) + ->setUserId($faker->uuid) + ->setUsername($faker->name) + ->setRole(Role::VIEWER) + ->setRedirect(false) + ; + }, + ], + 'case04_end_meeting' => [ + 'function' => 'endMeeting', + 'filename' => 'end_meeting.xml', + 'success' => true, + 'messageKey' => 'sentEndMeetingRequest', + 'parameters' => function(BigBlueButton $bbb): EndMeetingParameters { + $faker = Faker::create(); + + // arrange the BBB-server + $createMeetingParameters = new CreateMeetingParameters($faker->uuid, 'Meeting Room (case 04)'); + $createMeetingResponse = $bbb->createMeeting($createMeetingParameters); + self::assertTrue($createMeetingResponse->success()); + self::assertEquals('bbb-none', $createMeetingResponse->getParentMeetingId()); + + // create and return parameter for test + $endMeetingParameters = new EndMeetingParameters(); + + return $endMeetingParameters->setMeetingId($createMeetingResponse->getMeetingId()); + }, + ], + 'case05_is_meeting_running' => [ + 'function' => 'isMeetingRunning', + 'filename' => 'is_meeting_running.xml', + 'success' => true, + 'messageKey' => '', + 'parameters' => function(BigBlueButton $bbb): IsMeetingRunningParameters { + $faker = Faker::create(); + + // arrange the BBB-server + $createMeetingParameters = new CreateMeetingParameters($faker->uuid, 'Meeting Room (case 05)'); + $createMeetingResponse = $bbb->createMeeting($createMeetingParameters); + self::assertTrue($createMeetingResponse->success()); + self::assertEquals('bbb-none', $createMeetingResponse->getParentMeetingId()); + + // create and return parameter for test + $isMeetingRunningParameters = new IsMeetingRunningParameters(); + + return $isMeetingRunningParameters->setMeetingId($createMeetingResponse->getMeetingId()); + }, + ], + 'case06_list_of_meetings' => [ + 'function' => 'getMeetings', + 'filename' => 'get_meetings.xml', + 'success' => true, + 'messageKey' => '', + 'parameters' => function(BigBlueButton $bbb): void { + $faker = Faker::create(); + + // arrange the BBB-server + + // create meeting room + $createMeetingParametersParent = new CreateMeetingParameters($faker->uuid, 'Meeting Room 1 (case 06)'); + $createMeetingParametersParent + ->addMeta('endcallbackurl', $faker->url) + ->addMeta('presenter', $faker->name) + ; + $createMeetingResponseParent = $bbb->createMeeting($createMeetingParametersParent); + self::assertTrue($createMeetingResponseParent->success()); + self::assertEquals('bbb-none', $createMeetingResponseParent->getParentMeetingId()); + + // create breakout room + $createMeetingParametersChild = new CreateMeetingParameters($faker->uuid, 'Breakout Room (case 06)'); + $createMeetingParametersChild + ->addMeta('endcallbackurl', $faker->url) + ->addMeta('presenter', $faker->name) + ; + $createMeetingParametersChild->setParentMeetingId($createMeetingResponseParent->getMeetingId())->setBreakout(true)->setSequence(1); + $createMeetingResponseChild = $bbb->createMeeting($createMeetingParametersChild); + self::assertTrue($createMeetingResponseChild->success(), $createMeetingResponseChild->getMessage()); + self::assertEquals('', $createMeetingResponseChild->getMessage()); + self::assertNotEquals('bbb-none', $createMeetingResponseChild->getParentMeetingId()); + self::assertEquals($createMeetingResponseParent->getInternalMeetingId(), $createMeetingResponseChild->getParentMeetingId()); + }, + ], + 'case07_meeting_info_of_meeting_without_breakout_rooms' => [ + 'function' => 'getMeetingInfo', + 'filename' => 'get_meeting_info.xml', + 'success' => true, + 'messageKey' => '', + 'parameters' => function(BigBlueButton $bbb): GetMeetingInfoParameters { + $faker = Faker::create(); + + // arrange the BBB-server + $createMeetingParameters = new CreateMeetingParameters($faker->uuid, 'Meeting Room 1 (case 07)'); + $createMeetingParameters + ->addMeta('bbb-context', $faker->word) + ->addMeta('bbb-origin-server-common-name', $faker->word) + ->addMeta('bbb-origin-server-name', $faker->word) + ->addMeta('bbb-origin-tag', $faker->word) + ->addMeta('bbb-origin-version', $faker->word) + ->addMeta('bbb-recording-description', $faker->word) + ->addMeta('bbb-recording-name', $faker->word) + ->addMeta('bbb-recording-tags', $faker->word) + ->addMeta('bn-origin', $faker->word) + ->addMeta('bn-recording-ready-url', $faker->word) + ; + + $createMeetingResponse = $bbb->createMeeting($createMeetingParameters); + self::assertTrue($createMeetingResponse->success()); + self::assertEquals('bbb-none', $createMeetingResponse->getParentMeetingId()); + + // create and return parameter for test + $getMeetingInfoParameters = new GetMeetingInfoParameters(); + + return $getMeetingInfoParameters->setMeetingId($createMeetingResponse->getMeetingId()); + }, + ], + 'case08_meeting_info_of_breakout_room' => [ + 'function' => 'getMeetingInfo', + 'filename' => 'get_meeting_info_breakout_room.xml', + 'success' => true, + 'messageKey' => '', + 'parameters' => function(BigBlueButton $bbb): GetMeetingInfoParameters { + $faker = Faker::create(); + + // create meeting room + $createMeetingParametersParent = new CreateMeetingParameters($faker->uuid, 'Meeting Room 1 (case 08)'); + $createMeetingResponseParent = $bbb->createMeeting($createMeetingParametersParent); + self::assertTrue($createMeetingResponseParent->success()); + self::assertEquals('bbb-none', $createMeetingResponseParent->getParentMeetingId()); + + // create breakout room + $createMeetingParametersChild = new CreateMeetingParameters($faker->uuid, 'Breakout Room (case 08)'); + $createMeetingParametersChild + ->addMeta('bbb-context', $faker->word) + ->setParentMeetingId($createMeetingResponseParent->getMeetingId()) + ->setBreakout(true) + ->setSequence(1) + ; + $createMeetingResponseChild = $bbb->createMeeting($createMeetingParametersChild); + self::assertTrue($createMeetingResponseChild->success(), $createMeetingResponseChild->getMessage()); + self::assertEquals('', $createMeetingResponseChild->getMessage()); + self::assertNotEquals('bbb-none', $createMeetingResponseChild->getParentMeetingId()); + self::assertEquals($createMeetingResponseParent->getInternalMeetingId(), $createMeetingResponseChild->getParentMeetingId()); + + // create and return parameter for test + $getMeetingInfoParameters = new GetMeetingInfoParameters(); + + return $getMeetingInfoParameters->setMeetingId($createMeetingResponseChild->getInternalMeetingId()); + }, + ], + 'case09_meeting_info_of_meeting_with_breakout_rooms' => [ + 'function' => 'getMeetingInfo', + 'filename' => 'get_meeting_info_with_breakout_rooms.xml', + 'success' => true, + 'messageKey' => '', + 'parameters' => function(BigBlueButton $bbb): GetMeetingInfoParameters { + $faker = Faker::create(); + + // create meeting room + $createMeetingParametersParent = new CreateMeetingParameters($faker->uuid, 'Meeting Room 1 (case 09)'); + $createMeetingParametersParent + ->addMeta('endcallbackurl', $faker->url) + ->addMeta('presenter', $faker->name) + ; + $createMeetingResponseParent = $bbb->createMeeting($createMeetingParametersParent); + self::assertTrue($createMeetingResponseParent->success()); + self::assertEquals('bbb-none', $createMeetingResponseParent->getParentMeetingId()); + + // create breakout room + $createMeetingParametersChild = new CreateMeetingParameters($faker->uuid, 'Breakout Room (case 09)'); + $createMeetingParametersChild + ->setParentMeetingId($createMeetingResponseParent->getMeetingId()) + ->setBreakout(true) + ->setSequence(1) + ; + $createMeetingResponseChild = $bbb->createMeeting($createMeetingParametersChild); + self::assertTrue($createMeetingResponseChild->success(), $createMeetingResponseChild->getMessage()); + self::assertEquals('', $createMeetingResponseChild->getMessage()); + self::assertNotEquals('bbb-none', $createMeetingResponseChild->getParentMeetingId()); + self::assertEquals($createMeetingResponseParent->getInternalMeetingId(), $createMeetingResponseChild->getParentMeetingId()); + + // create and return parameter for test + return new GetMeetingInfoParameters($createMeetingResponseParent->getMeetingId()); + }, + ], + 'case10_hooks_create' => [ + 'function' => 'hooksCreate', + 'filename' => 'hooks_create.xml', + 'success' => true, + 'messageKey' => '', + 'parameters' => function(BigBlueButton $bbb): HooksCreateParameters { + $faker = Faker::create(); + + // create and return parameter for test + return new HooksCreateParameters($faker->url); + }, + ], + 'case11_hooks_create_existing' => [ + 'function' => 'hooksCreate', + 'filename' => 'hooks_create_existing.xml', + 'success' => true, + 'messageKey' => 'duplicateWarning', + 'parameters' => function(BigBlueButton $bbb): HooksCreateParameters { + $faker = Faker::create(); + $url = $faker->url; + + // create hook + $hooksCreateParameters = new HooksCreateParameters($url); + $hooksCreateResponse = $bbb->hooksCreate($hooksCreateParameters); + self::assertTrue($hooksCreateResponse->success()); + + // create and return parameter for test + return new HooksCreateParameters($url); + }, + ], + 'case12_hooks_list' => [ + 'function' => 'hooksList', + 'filename' => 'hooks_list.xml', + 'success' => true, + 'messageKey' => '', + 'parameters' => function(BigBlueButton $bbb): void { + $faker = Faker::create(); + + // create meeting + $createMeetingParameters = new CreateMeetingParameters($faker->uuid, 'Meeting Room (case 12)'); + $createMeetingResponse = $bbb->createMeeting($createMeetingParameters); + self::assertTrue($createMeetingResponse->success()); + self::assertEquals('bbb-none', $createMeetingResponse->getParentMeetingId()); + + // create hook #1 (with meeting) + $hooksCreateParameters = new HooksCreateParameters($faker->url); + $hooksCreateParameters->setMeetingId($createMeetingResponse->getMeetingId()); + $hooksCreateResponse_2 = $bbb->hooksCreate($hooksCreateParameters); + self::assertTrue($hooksCreateResponse_2->success()); + + // create hook #2 (w/o meeting) + $hooksCreateParameters = new HooksCreateParameters($faker->url); + $hooksCreateResponse_1 = $bbb->hooksCreate($hooksCreateParameters); + self::assertTrue($hooksCreateResponse_1->success()); + }, + ], + 'case13_hooks_destroy' => [ + 'function' => 'hooksDestroy', + 'filename' => 'hooks_destroy.xml', + 'success' => true, + 'messageKey' => '', + 'parameters' => function(BigBlueButton $bbb): HooksDestroyParameters { + $faker = Faker::create(); + + // create hook + $hooksCreateParameters = new HooksCreateParameters($faker->url); + $hooksCreateResponse = $bbb->hooksCreate($hooksCreateParameters); + self::assertTrue($hooksCreateResponse->success()); + self::assertIsInt($hooksCreateResponse->getHookId()); + + // create and return parameter for test + return new HooksDestroyParameters($hooksCreateResponse->getHookId()); + }, + ], + 'case14_hooks_destroy_not_found' => [ + 'function' => 'hooksDestroy', + 'filename' => 'hooks_destroy_failed_not_found.xml', + 'success' => false, + 'messageKey' => 'destroyMissingHook', + 'parameters' => function(BigBlueButton $bbb): HooksDestroyParameters { + $faker = Faker::create(); + + // create and return parameter for test + return new HooksDestroyParameters($faker->numberBetween()); + }, + ], + 'case15_insert_document' => [ + 'function' => 'insertDocument', + 'filename' => 'insert_document.xml', + 'success' => true, + 'messageKey' => '', + 'parameters' => function(BigBlueButton $bbb): InsertDocumentParameters { + $faker = Faker::create(); + + // arrange the BBB-server + $createMeetingParameters = new CreateMeetingParameters($faker->uuid, 'Meeting Room (case 05)'); + $createMeetingResponse = $bbb->createMeeting($createMeetingParameters); + self::assertTrue($createMeetingResponse->success()); + self::assertEquals('bbb-none', $createMeetingResponse->getParentMeetingId()); + + // create and return parameter for test + $insertDocumentParameters = new InsertDocumentParameters($createMeetingResponse->getMeetingId()); + + $insertDocumentParameters + ->addPresentation('https://freetestdata.com/wp-content/uploads/2021/09/Free_Test_Data_100KB_PDF.pdf') + ->addPresentation('https://freetestdata.com/wp-content/uploads/2022/02/Free_Test_Data_117KB_JPG.jpg') + ->addPresentation('https://freetestdata.com/wp-content/uploads/2021/09/500kb.png') + ->addPresentation('https://freetestdata.com/wp-content/uploads/2021/09/1.svg') + ; + + return $insertDocumentParameters; + }, + ], + ]; + } + + private function closeAllMeetings(): void + { + $meetings = $this->bbb->getMeetings()->getMeetings(); + + foreach ($meetings as $meeting) { + $meetingId = $meeting->getInternalMeetingId(); + $endMeetingResponse = $this->bbb->endMeeting(new EndMeetingParameters($meetingId)); + self::assertEquals('SUCCESS', $endMeetingResponse->getReturnCode(), $endMeetingResponse->getMessage()); + self::assertTrue($endMeetingResponse->success()); + self::assertEquals('sentEndMeetingRequest', $endMeetingResponse->getMessageKey()); + } + + // ensure that no meetings exist anymore + self::assertEmpty($this->bbb->getMeetings()->getMeetings()); + } + + private function destroyAllHooks(): void + { + $hooks = $this->bbb->hooksList()->getHooks(); + + foreach ($hooks as $hook) { + self::assertInstanceOf(Hook::class, $hook); + $hookId = $hook->getHookId(); + $hooksDestroyResponse = $this->bbb->hooksDestroy(new HooksDestroyParameters($hookId)); + self::assertEquals('SUCCESS', $hooksDestroyResponse->getReturnCode(), $hooksDestroyResponse->getMessage()); + self::assertTrue($hooksDestroyResponse->success()); + self::assertEquals('', $hooksDestroyResponse->getMessageKey()); + } + + // ensure that no hooks exist anymore + self::assertEmpty($this->bbb->hooksList()->getHooks()); + } + + private function assertSameStructureOfXml(\SimpleXMLElement $xmlToBe, \SimpleXMLElement $xmlAsIs): void + { + $arrayToBe = $this->getStructureOfXmlAsArray($xmlToBe); + $arrayAsIs = $this->getStructureOfXmlAsArray($xmlAsIs); + + $expectedItemsMissingInResponse = array_diff($arrayToBe, $arrayAsIs); + $respondedItemsNotExpected = array_diff($arrayAsIs, $arrayToBe); + + $this->assertEqualsCanonicalizing( + $arrayToBe, + $arrayAsIs, + "Details:\n\n" . + 'Missing items in response: ' . implode('; ', $expectedItemsMissingInResponse) . "\n\n" . + 'Missing items in the file: ' . implode('; ', $respondedItemsNotExpected) . "\n\n" + ); + } + + /** + * Recursive function to flatten an array, which shall represent the structure of an + * element. For this, arrays that contain several children (= array with sequential + * numbers as keys) will get a list of unique attributes across all children. + * + * @param array $array + * + * @return array + */ + private function flattenArray(array $array, string $prefix = ''): array + { + $result = []; + + foreach ($array as $key => $value) { + $new_key = $prefix . (empty($prefix) ? '' : '.') . $key; + + // prepare value + if (is_array($value)) { + // a sequential array (= not associative) is understood as a group of + // similar children, thus their attributes should be similar. + if (!$this->isAssociativeArray($value)) { + // get a full collection of unique attributes within the group of children + $attributeCollection = []; + + foreach ($value as $child) { + if (!is_array($child)) { + continue; + } + + foreach ($child as $attributeKey => $attributeValue) { + if (!key_exists($attributeKey, $attributeCollection)) { + $attributeCollection[$attributeKey] = $attributeValue; + } + } + } + + $value = $attributeCollection; + } + } + + // compose result + if (is_array($value)) { + if (count($value) > 0) { + $result = array_merge($result, [$new_key => $value], $this->flattenArray($value, $new_key)); + } else { + $result[$new_key] = 'empty array'; // empty array + } + } else { + $result[$new_key] = $value; + } + } + + return $result; + } + + /** + * Function that helps to determine if an array is sequential or associative. + * + * Remark: With PHP 8.1 this function can be replaced by 'array_is_list'. + * + * @param array $array + */ + private function isAssociativeArray(array $array): bool + { + if (array_keys($array) === range(0, count($array) - 1)) { + return false; + } + + return true; + } + + /** + * @return array + */ + private function getStructureOfXmlAsArray(\SimpleXMLElement $xml): array + { + // transform XML to ARRAY (via JSON) + $json = json_encode($xml); + self::assertIsString($json); + $array = json_decode($json, true); + + // flatten multidimensional array to string-based hierarchy + $flattenArray = $this->flattenArray($array); + + // only the keys are needed + $keys = array_keys($flattenArray); + + // bring the key into alphabetic order + sort($keys); + + return $keys; + } +} diff --git a/tests/fixtures/hooks_destroy_params_no_id.xml b/tests/fixtures/hooks_destroy_params_no_id.xml deleted file mode 100644 index 297fed8d..00000000 --- a/tests/fixtures/hooks_destroy_params_no_id.xml +++ /dev/null @@ -1,5 +0,0 @@ - - FAILED - missingParamHookID - You must specify a hookID in the parameters. - \ No newline at end of file diff --git a/tests/fixtures/bbb_logo.png b/tests/fixtures/images/bbb_logo.png similarity index 100% rename from tests/fixtures/bbb_logo.png rename to tests/fixtures/images/bbb_logo.png diff --git a/tests/fixtures/insert_document_presentations.xml b/tests/fixtures/insert_document_presentations.xml deleted file mode 100644 index 997ecaf5..00000000 --- a/tests/fixtures/insert_document_presentations.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/tests/fixtures/presentation_with_filename.xml b/tests/fixtures/presentation_with_filename.xml deleted file mode 100644 index 2b346089..00000000 --- a/tests/fixtures/presentation_with_filename.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/tests/fixtures/requests/insert_document_presentations.xml b/tests/fixtures/requests/insert_document_presentations.xml new file mode 100644 index 00000000..1edfb949 --- /dev/null +++ b/tests/fixtures/requests/insert_document_presentations.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/fixtures/insert_document_presentations_with_options.xml b/tests/fixtures/requests/insert_document_presentations_with_options.xml similarity index 100% rename from tests/fixtures/insert_document_presentations_with_options.xml rename to tests/fixtures/requests/insert_document_presentations_with_options.xml diff --git a/tests/fixtures/presentation_with_embedded_file.xml b/tests/fixtures/requests/presentation_with_embedded_file.xml similarity index 100% rename from tests/fixtures/presentation_with_embedded_file.xml rename to tests/fixtures/requests/presentation_with_embedded_file.xml diff --git a/tests/fixtures/requests/presentation_with_filename.xml b/tests/fixtures/requests/presentation_with_filename.xml new file mode 100644 index 00000000..f7da54da --- /dev/null +++ b/tests/fixtures/requests/presentation_with_filename.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/fixtures/presentation_with_url.xml b/tests/fixtures/requests/presentation_with_url.xml similarity index 56% rename from tests/fixtures/presentation_with_url.xml rename to tests/fixtures/requests/presentation_with_url.xml index cf45ce3a..f216f0e9 100644 --- a/tests/fixtures/presentation_with_url.xml +++ b/tests/fixtures/requests/presentation_with_url.xml @@ -1,6 +1,6 @@ - + diff --git a/tests/fixtures/api_version.xml b/tests/fixtures/responses/api_version.xml similarity index 100% rename from tests/fixtures/api_version.xml rename to tests/fixtures/responses/api_version.xml diff --git a/tests/fixtures/create_meeting.xml b/tests/fixtures/responses/create_meeting.xml similarity index 100% rename from tests/fixtures/create_meeting.xml rename to tests/fixtures/responses/create_meeting.xml diff --git a/tests/fixtures/delete_recordings.xml b/tests/fixtures/responses/delete_recordings.xml similarity index 100% rename from tests/fixtures/delete_recordings.xml rename to tests/fixtures/responses/delete_recordings.xml diff --git a/tests/fixtures/end_meeting.xml b/tests/fixtures/responses/end_meeting.xml similarity index 100% rename from tests/fixtures/end_meeting.xml rename to tests/fixtures/responses/end_meeting.xml diff --git a/tests/fixtures/get_meeting_info.xml b/tests/fixtures/responses/get_meeting_info.xml similarity index 94% rename from tests/fixtures/get_meeting_info.xml rename to tests/fixtures/responses/get_meeting_info.xml index f3e4e219..86d8ba66 100644 --- a/tests/fixtures/get_meeting_info.xml +++ b/tests/fixtures/responses/get_meeting_info.xml @@ -73,9 +73,7 @@ - true - b97b512f2c92c0ffe7a3476152525807daa1c676-1524213151782 - 1 + false Best BBB Developers Club Moodle @@ -90,6 +88,4 @@ Bigbluebutton "Mock meeting for testing getMeetingInfo" - - \ No newline at end of file diff --git a/tests/fixtures/responses/get_meeting_info_breakout_room.xml b/tests/fixtures/responses/get_meeting_info_breakout_room.xml new file mode 100644 index 00000000..743d4ccc --- /dev/null +++ b/tests/fixtures/responses/get_meeting_info_breakout_room.xml @@ -0,0 +1,83 @@ + + + SUCCESS + Mock meeting for testing getMeetingInfo API method + 117b12ae2656972d330b6bad58878541-28-15 + 178757fcedd9449054536162cdfe861ddebc70ba-1453206317376 + 1453206317376 + Tue Jan 19 07:25:17 EST 2016 + 70100 + 613-555-1234 + dbfc7207321527bbb870c82028 + 4bfbbeeb4a65cacaefe3676633 + true + 20 + true + true + false + 1453206317380 + 1453206325002 + 2 + 1 + 2 + 1 + 20 + 2 + + + amslzbgzzddp + Ernie Abernathy + MODERATOR + true + false + true + true + HTML5 + + + + xi7y7gpmyq1g + Barrett Kutch + MODERATOR + false + false + true + false + FLASH + + true + #FF0033 + a:focus{color:#0181eb} + + + + srfd2uad4x9s + Peter Parker + VIEWER + false + false + true + true + HTML5 + + + + 6ntb564ibhnq + Bruce Wayne + VIEWER + false + true + false + false + HTML5 + + + + true + ParentMeetingId + 1 + false + + Best BBB Developers Club + + \ No newline at end of file diff --git a/tests/fixtures/responses/get_meeting_info_with_breakout_rooms.xml b/tests/fixtures/responses/get_meeting_info_with_breakout_rooms.xml new file mode 100644 index 00000000..8a076f4a --- /dev/null +++ b/tests/fixtures/responses/get_meeting_info_with_breakout_rooms.xml @@ -0,0 +1,86 @@ + + + SUCCESS + Mock meeting for testing getMeetingInfo API method + 117b12ae2656972d330b6bad58878541-28-15 + 178757fcedd9449054536162cdfe861ddebc70ba-1453206317376 + 1453206317376 + Tue Jan 19 07:25:17 EST 2016 + 70100 + 613-555-1234 + dbfc7207321527bbb870c82028 + 4bfbbeeb4a65cacaefe3676633 + true + 20 + true + true + false + 1453206317380 + 1453206325002 + 2 + 1 + 2 + 1 + 20 + 2 + + + amslzbgzzddp + Ernie Abernathy + MODERATOR + true + false + true + true + HTML5 + + + + xi7y7gpmyq1g + Barrett Kutch + MODERATOR + false + false + true + false + FLASH + + true + #FF0033 + a:focus{color:#0181eb} + + + + srfd2uad4x9s + Peter Parker + VIEWER + false + false + true + true + HTML5 + + + + 6ntb564ibhnq + Bruce Wayne + VIEWER + false + true + false + false + HTML5 + + + + false + + breakout-room-id-1 + breakout-room-id-2 + breakout-room-id-3 + + + Prof. Maud Corkery II + http://www.hegmann.biz/explicabo-praesentium-labore-dolor + + \ No newline at end of file diff --git a/tests/fixtures/get_meetings.xml b/tests/fixtures/responses/get_meetings.xml similarity index 91% rename from tests/fixtures/get_meetings.xml rename to tests/fixtures/responses/get_meetings.xml index 39a8afe4..adde2a46 100644 --- a/tests/fixtures/get_meetings.xml +++ b/tests/fixtures/responses/get_meetings.xml @@ -61,7 +61,10 @@ Prof. Maud Corkery II http://www.hegmann.biz/explicabo-praesentium-labore-dolor - false + true + ParentMeetingId + 1 + false Marty Lueilwitz @@ -93,6 +96,11 @@ http://www.muller.biz/autem-dolor-aut-nam-doloribus-molestiae false + + breakout-room-id-1 + breakout-room-id-2 + breakout-room-id-3 + \ No newline at end of file diff --git a/tests/fixtures/get_recording_text_tracks.json b/tests/fixtures/responses/get_recording_text_tracks.json similarity index 100% rename from tests/fixtures/get_recording_text_tracks.json rename to tests/fixtures/responses/get_recording_text_tracks.json diff --git a/tests/fixtures/get_recordings.xml b/tests/fixtures/responses/get_recordings.xml similarity index 100% rename from tests/fixtures/get_recordings.xml rename to tests/fixtures/responses/get_recordings.xml diff --git a/tests/fixtures/hooks_create.xml b/tests/fixtures/responses/hooks_create.xml similarity index 100% rename from tests/fixtures/hooks_create.xml rename to tests/fixtures/responses/hooks_create.xml diff --git a/tests/fixtures/hooks_create_existing.xml b/tests/fixtures/responses/hooks_create_existing.xml similarity index 100% rename from tests/fixtures/hooks_create_existing.xml rename to tests/fixtures/responses/hooks_create_existing.xml diff --git a/tests/fixtures/hooks_create_error.xml b/tests/fixtures/responses/hooks_create_failed_error.xml similarity index 100% rename from tests/fixtures/hooks_create_error.xml rename to tests/fixtures/responses/hooks_create_failed_error.xml diff --git a/tests/fixtures/hooks_destroy.xml b/tests/fixtures/responses/hooks_destroy.xml similarity index 100% rename from tests/fixtures/hooks_destroy.xml rename to tests/fixtures/responses/hooks_destroy.xml diff --git a/tests/fixtures/hooks_destroy_error.xml b/tests/fixtures/responses/hooks_destroy_failed_error.xml similarity index 100% rename from tests/fixtures/hooks_destroy_error.xml rename to tests/fixtures/responses/hooks_destroy_failed_error.xml diff --git a/tests/fixtures/hooks_create_no_hook_id.xml b/tests/fixtures/responses/hooks_destroy_failed_no_id.xml similarity index 100% rename from tests/fixtures/hooks_create_no_hook_id.xml rename to tests/fixtures/responses/hooks_destroy_failed_no_id.xml diff --git a/tests/fixtures/hooks_destroy_not_found.xml b/tests/fixtures/responses/hooks_destroy_failed_not_found.xml similarity index 100% rename from tests/fixtures/hooks_destroy_not_found.xml rename to tests/fixtures/responses/hooks_destroy_failed_not_found.xml diff --git a/tests/fixtures/hooks_list.xml b/tests/fixtures/responses/hooks_list.xml similarity index 100% rename from tests/fixtures/hooks_list.xml rename to tests/fixtures/responses/hooks_list.xml diff --git a/tests/fixtures/insert_document.xml b/tests/fixtures/responses/insert_document.xml similarity index 100% rename from tests/fixtures/insert_document.xml rename to tests/fixtures/responses/insert_document.xml diff --git a/tests/fixtures/is_meeting_running.xml b/tests/fixtures/responses/is_meeting_running.xml similarity index 100% rename from tests/fixtures/is_meeting_running.xml rename to tests/fixtures/responses/is_meeting_running.xml diff --git a/tests/fixtures/join_meeting.xml b/tests/fixtures/responses/join_meeting.xml similarity index 100% rename from tests/fixtures/join_meeting.xml rename to tests/fixtures/responses/join_meeting.xml diff --git a/tests/fixtures/publish_recordings.xml b/tests/fixtures/responses/publish_recordings.xml similarity index 100% rename from tests/fixtures/publish_recordings.xml rename to tests/fixtures/responses/publish_recordings.xml diff --git a/tests/fixtures/put_recording_text_track_success.json b/tests/fixtures/responses/put_recording_text_track_success.json similarity index 100% rename from tests/fixtures/put_recording_text_track_success.json rename to tests/fixtures/responses/put_recording_text_track_success.json diff --git a/tests/fixtures/update_recordings.xml b/tests/fixtures/responses/update_recordings.xml similarity index 100% rename from tests/fixtures/update_recordings.xml rename to tests/fixtures/responses/update_recordings.xml