Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Core/Hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
class Hook
{
private readonly int $hookId;
private readonly string $hookId;

private readonly string $meetingId;

Expand All @@ -39,14 +39,14 @@ class Hook

public function __construct(protected \SimpleXMLElement $rawXml)
{
$this->hookId = (int) $this->rawXml->hookID->__toString();
$this->hookId = $this->rawXml->hookID->__toString();
$this->callbackUrl = $this->rawXml->callbackURL->__toString();
$this->meetingId = $this->rawXml->meetingID->__toString();
$this->permanentHook = $this->rawXml->permanentHook->__toString() === 'true';
$this->rawData = $this->rawXml->rawData->__toString() === 'true';
}

public function getHookId(): int
public function getHookId(): string
{
return $this->hookId;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Responses/HooksCreateResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
*/
class HooksCreateResponse extends BaseResponse
{
public function getHookId(): int
public function getHookId(): string
{
return (int) $this->rawXml->hookID->__toString();
return $this->rawXml->hookID->__toString();
}

public function isPermanentHook(): bool
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/hooks_create.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<response>
<returncode>SUCCESS</returncode>
<hookID>1</hookID>
<hookID>12345678-1234-5678-1234-567812345678</hookID>
<permanentHook>false</permanentHook>
<rawData>false</rawData>
</response>
</response>
4 changes: 2 additions & 2 deletions tests/fixtures/hooks_create_existing.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<response>
<returncode>SUCCESS</returncode>
<hookID>1</hookID>
<hookID>12345678-1234-5678-1234-567812345678</hookID>
<messageKey>duplicateWarning</messageKey>
<message>There is already a hook for this callback URL.</message>
</response>
</response>
6 changes: 3 additions & 3 deletions tests/fixtures/hooks_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
<returncode>SUCCESS</returncode>
<hooks>
<hook>
<hookID>1</hookID>
<hookID>12345678-1234-5678-1234-567812345678</hookID>
<callbackURL><![CDATA[http://postcatcher.in/catchers/abcdefghijk]]></callbackURL>
<meetingID><![CDATA[my-meeting]]></meetingID>
<permanentHook>false</permanentHook>
<rawData>false</rawData>
</hook>
<hook>
<hookID>2</hookID>
<hookID>23456789-1234-5678-1234-567812345678</hookID>
<callbackURL><![CDATA[http://postcatcher.in/catchers/1234567890]]></callbackURL>
<permanentHook>false</permanentHook>
<rawData>false</rawData>
</hook>
</hooks>
</response>
</response>
12 changes: 6 additions & 6 deletions tests/unit/BigBlueButtonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ public function testHooksCreate(): void

$xml = '<response>
<returncode>SUCCESS</returncode>
<hookID>1</hookID>
<hookID>12345678-1234-5678-1234-567812345678</hookID>
<permanentHook>false</permanentHook>
<rawData>false</rawData>
</response>';
Expand All @@ -697,7 +697,7 @@ public function testHooksCreate(): void
$response = $this->bbb->hooksCreate($params);

$this->assertTrue($response->success());
$this->assertSame(1, $response->getHookId());
$this->assertSame('12345678-1234-5678-1234-567812345678', $response->getHookId());
$this->assertFalse($response->isPermanentHook());
$this->assertFalse($response->hasRawData());
}
Expand All @@ -710,14 +710,14 @@ public function testHooksList(): void
<returncode>SUCCESS</returncode>
<hooks>
<hook>
<hookID>1</hookID>
<hookID>12345678-1234-5678-1234-567812345678</hookID>
<callbackURL><![CDATA[http://postcatcher.in/catchers/abcdefghijk]]></callbackURL>
<meetingID><![CDATA[my-meeting]]></meetingID>
<permanentHook>false</permanentHook>
<rawData>false</rawData>
</hook>
<hook>
<hookID>2</hookID>
<hookID>23456789-1234-5678-1234-567812345678</hookID>
<callbackURL><![CDATA[http://postcatcher.in/catchers/1234567890]]></callbackURL>
<permanentHook>false</permanentHook>
<rawData>false</rawData>
Expand All @@ -734,15 +734,15 @@ public function testHooksList(): void

// Hook for a single meeting
$meetingHook = $response->getHooks()[0];
$this->assertSame(1, $meetingHook->getHookId());
$this->assertSame('12345678-1234-5678-1234-567812345678', $meetingHook->getHookId());
$this->assertSame('http://postcatcher.in/catchers/abcdefghijk', $meetingHook->getCallbackURL());
$this->assertSame('my-meeting', $meetingHook->getMeetingID());
$this->assertFalse($meetingHook->isPermanentHook());
$this->assertFalse($meetingHook->hasRawData());

// Global hook
$globalHook = $response->getHooks()[1];
$this->assertSame(2, $globalHook->getHookId());
$this->assertSame('23456789-1234-5678-1234-567812345678', $globalHook->getHookId());
$this->assertSame('http://postcatcher.in/catchers/1234567890', $globalHook->getCallbackURL());
$this->assertFalse($globalHook->isPermanentHook());
$this->assertFalse($globalHook->hasRawData());
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Parameters/HooksDestroyParametersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class HooksDestroyParametersTest extends TestCase
{
public function testHooksDestroyParameters(): void
{
$hooksCreateParameters = new HooksDestroyParameters((string) $hookId = $this->faker->numberBetween(1, 50));
$hooksCreateParameters = new HooksDestroyParameters($hookId = $this->faker->uuid());

$this->assertEquals($hookId, $hooksCreateParameters->getHookID());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Responses/HooksCreateResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ protected function setUp(): void
public function testHooksCreateResponseContent(): void
{
$this->assertEquals('SUCCESS', $this->createResponse->getReturnCode());
$this->assertEquals(1, $this->createResponse->getHookId());
$this->assertEquals('12345678-1234-5678-1234-567812345678', $this->createResponse->getHookId());
$this->assertFalse($this->createResponse->isPermanentHook());
$this->assertFalse($this->createResponse->hasRawData());
}

public function testHooksCreateResponseTypes(): void
{
$this->assertEachGetterValueIsString($this->createResponse, ['getReturnCode']);
$this->assertEachGetterValueIsInteger($this->createResponse, ['getHookId']);
$this->assertEachGetterValueIsString($this->createResponse, ['getHookId']);
$this->assertEachGetterValueIsBoolean($this->createResponse, ['isPermanentHook', 'hasRawData']);
}
}
4 changes: 2 additions & 2 deletions tests/unit/Responses/HooksListResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function testHooksListResponseContent(): void

$this->assertEquals('my-meeting', $aHook->getMeetingId());
$this->assertEquals('http://postcatcher.in/catchers/abcdefghijk', $aHook->getCallbackUrl());
$this->assertEquals(1, $aHook->getHookId());
$this->assertEquals('12345678-1234-5678-1234-567812345678', $aHook->getHookId());
$this->assertFalse($aHook->isPermanentHook());
$this->assertFalse($aHook->hasRawData());
}
Expand All @@ -59,7 +59,7 @@ public function testHooksListResponseTypes(): void
$aHook = $this->listResponse->getHooks()[0];

$this->assertEachGetterValueIsString($aHook, ['getCallbackUrl', 'getMeetingId']);
$this->assertEachGetterValueIsInteger($aHook, ['getHookId']);
$this->assertEachGetterValueIsString($aHook, ['getHookId']);
$this->assertEachGetterValueIsBoolean($aHook, ['hasRawData', 'isPermanentHook']);
}
}
Loading