Skip to content

Commit 33bf2da

Browse files
committed
Merge branch 'master' into tests/hooks
2 parents 06881ff + ec0a70f commit 33bf2da

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

src/BigBlueButton.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class BigBlueButton
7878
public function __construct(?string $baseUrl = null, ?string $secret = null, ?array $opts = [])
7979
{
8080
// Provide an early error message if configuration is wrong
81-
if (is_null($secret) && false === getenv('BBB_SERVER_BASE_URL')) {
81+
if (is_null($baseUrl) && false === getenv('BBB_SERVER_BASE_URL')) {
8282
throw new \RuntimeException('No BBB-Server-Url found! Please provide it either in constructor ' .
8383
"(1st argument) or by environment variable 'BBB_SERVER_BASE_URL'!");
8484
}
@@ -225,6 +225,19 @@ public function isMeetingRunning(IsMeetingRunningParameters $meetingParams): IsM
225225
return new IsMeetingRunningResponse($xml);
226226
}
227227

228+
/**
229+
* Checks weather a meeting is existing.
230+
*
231+
* @throws BadResponseException
232+
*/
233+
public function isMeetingExisting(string $meetingId): bool
234+
{
235+
$getMeetingInfoParameters = new GetMeetingInfoParameters($meetingId);
236+
$meetingInfoResponse = $this->getMeetingInfo($getMeetingInfoParameters);
237+
238+
return $meetingInfoResponse->success();
239+
}
240+
228241
/**
229242
* @deprecated Replaced by same function-name provided by UrlBuilder-class
230243
*/
@@ -574,7 +587,9 @@ private function sendRequest(string $url, string $payload = '', string $contentT
574587
*/
575588
private function processXmlResponse(string $url, string $payload = ''): \SimpleXMLElement
576589
{
577-
return new \SimpleXMLElement($this->sendRequest($url, $payload, 'application/xml'));
590+
$response = $this->sendRequest($url, $payload, $contentType);
591+
592+
return new \SimpleXMLElement($response);
578593
}
579594

580595
/**

tests/BigBlueButtonTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,24 @@ public function testIsMeetingRunning(): void
273273
$this->assertEquals(false, $result->isRunning());
274274
}
275275

276+
public function testIsMeetingExisting(): void
277+
{
278+
$meetingId = $this->faker->uuid;
279+
280+
// check existence of non-existing meeting
281+
$isMeetingExisting = $this->bbb->isMeetingExisting($meetingId);
282+
$this->assertFalse($isMeetingExisting);
283+
284+
// create meeting
285+
$createMeetingResponse = $this->bbb->createMeeting(new CreateMeetingParameters($meetingId, $this->faker->word));
286+
$this->assertEquals('SUCCESS', $createMeetingResponse->getReturnCode());
287+
$this->assertTrue($createMeetingResponse->success());
288+
289+
// check existence of existing meeting
290+
$isMeetingExisting = $this->bbb->isMeetingExisting($meetingId);
291+
$this->assertTrue($isMeetingExisting);
292+
}
293+
276294
// Get Meetings
277295

278296
/**

0 commit comments

Comments
 (0)