Skip to content

Commit 393f197

Browse files
Fix invalid hook type (#244)
Co-authored-by: Felix Jacobi <felix@jacobi-hamburg.net>
1 parent d3a37bf commit 393f197

9 files changed

Lines changed: 23 additions & 23 deletions

File tree

src/Core/Hook.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828
final class Hook
2929
{
30-
private readonly int $hookId;
30+
private readonly string $hookId;
3131

3232
private readonly string $meetingId;
3333

@@ -39,14 +39,14 @@ final class Hook
3939

4040
public function __construct(private readonly \SimpleXMLElement $rawXml)
4141
{
42-
$this->hookId = (int) $this->rawXml->hookID->__toString();
42+
$this->hookId = $this->rawXml->hookID->__toString();
4343
$this->callbackUrl = $this->rawXml->callbackURL->__toString();
4444
$this->meetingId = $this->rawXml->meetingID->__toString();
4545
$this->permanentHook = $this->rawXml->permanentHook->__toString() === 'true';
4646
$this->rawData = $this->rawXml->rawData->__toString() === 'true';
4747
}
4848

49-
public function getHookId(): int
49+
public function getHookId(): string
5050
{
5151
return $this->hookId;
5252
}

src/Responses/HooksCreateResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
*/
2828
final class HooksCreateResponse extends BaseResponse
2929
{
30-
public function getHookId(): int
30+
public function getHookId(): string
3131
{
32-
return (int) $this->rawXml->hookID->__toString();
32+
return $this->rawXml->hookID->__toString();
3333
}
3434

3535
public function isPermanentHook(): bool

tests/fixtures/hooks_create.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<response>
22
<returncode>SUCCESS</returncode>
3-
<hookID>1</hookID>
3+
<hookID>12345678-1234-5678-1234-567812345678</hookID>
44
<permanentHook>false</permanentHook>
55
<rawData>false</rawData>
6-
</response>
6+
</response>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<response>
22
<returncode>SUCCESS</returncode>
3-
<hookID>1</hookID>
3+
<hookID>12345678-1234-5678-1234-567812345678</hookID>
44
<messageKey>duplicateWarning</messageKey>
55
<message>There is already a hook for this callback URL.</message>
6-
</response>
6+
</response>

tests/fixtures/hooks_list.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
<returncode>SUCCESS</returncode>
33
<hooks>
44
<hook>
5-
<hookID>1</hookID>
5+
<hookID>12345678-1234-5678-1234-567812345678</hookID>
66
<callbackURL><![CDATA[http://postcatcher.in/catchers/abcdefghijk]]></callbackURL>
77
<meetingID><![CDATA[my-meeting]]></meetingID>
88
<permanentHook>false</permanentHook>
99
<rawData>false</rawData>
1010
</hook>
1111
<hook>
12-
<hookID>2</hookID>
12+
<hookID>23456789-1234-5678-1234-567812345678</hookID>
1313
<callbackURL><![CDATA[http://postcatcher.in/catchers/1234567890]]></callbackURL>
1414
<permanentHook>false</permanentHook>
1515
<rawData>false</rawData>
1616
</hook>
1717
</hooks>
18-
</response>
18+
</response>

tests/unit/BigBlueButtonTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ public function testHooksCreate(): void
687687

688688
$xml = '<response>
689689
<returncode>SUCCESS</returncode>
690-
<hookID>1</hookID>
690+
<hookID>12345678-1234-5678-1234-567812345678</hookID>
691691
<permanentHook>false</permanentHook>
692692
<rawData>false</rawData>
693693
</response>';
@@ -697,7 +697,7 @@ public function testHooksCreate(): void
697697
$response = $this->bbb->hooksCreate($params);
698698

699699
$this->assertTrue($response->success());
700-
$this->assertSame(1, $response->getHookId());
700+
$this->assertSame('12345678-1234-5678-1234-567812345678', $response->getHookId());
701701
$this->assertFalse($response->isPermanentHook());
702702
$this->assertFalse($response->hasRawData());
703703
}
@@ -710,14 +710,14 @@ public function testHooksList(): void
710710
<returncode>SUCCESS</returncode>
711711
<hooks>
712712
<hook>
713-
<hookID>1</hookID>
713+
<hookID>12345678-1234-5678-1234-567812345678</hookID>
714714
<callbackURL><![CDATA[http://postcatcher.in/catchers/abcdefghijk]]></callbackURL>
715715
<meetingID><![CDATA[my-meeting]]></meetingID>
716716
<permanentHook>false</permanentHook>
717717
<rawData>false</rawData>
718718
</hook>
719719
<hook>
720-
<hookID>2</hookID>
720+
<hookID>23456789-1234-5678-1234-567812345678</hookID>
721721
<callbackURL><![CDATA[http://postcatcher.in/catchers/1234567890]]></callbackURL>
722722
<permanentHook>false</permanentHook>
723723
<rawData>false</rawData>
@@ -734,15 +734,15 @@ public function testHooksList(): void
734734

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

743743
// Global hook
744744
$globalHook = $response->getHooks()[1];
745-
$this->assertSame(2, $globalHook->getHookId());
745+
$this->assertSame('23456789-1234-5678-1234-567812345678', $globalHook->getHookId());
746746
$this->assertSame('http://postcatcher.in/catchers/1234567890', $globalHook->getCallbackURL());
747747
$this->assertFalse($globalHook->isPermanentHook());
748748
$this->assertFalse($globalHook->hasRawData());

tests/unit/Parameters/HooksDestroyParametersTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class HooksDestroyParametersTest extends TestCase
2929
{
3030
public function testHooksDestroyParameters(): void
3131
{
32-
$hooksCreateParameters = new HooksDestroyParameters((string) $hookId = $this->faker->numberBetween(1, 50));
32+
$hooksCreateParameters = new HooksDestroyParameters($hookId = $this->faker->uuid());
3333

3434
$this->assertEquals($hookId, $hooksCreateParameters->getHookID());
3535
}

tests/unit/Responses/HooksCreateResponseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ protected function setUp(): void
4141
public function testHooksCreateResponseContent(): void
4242
{
4343
$this->assertEquals('SUCCESS', $this->createResponse->getReturnCode());
44-
$this->assertEquals(1, $this->createResponse->getHookId());
44+
$this->assertEquals('12345678-1234-5678-1234-567812345678', $this->createResponse->getHookId());
4545
$this->assertFalse($this->createResponse->isPermanentHook());
4646
$this->assertFalse($this->createResponse->hasRawData());
4747
}
4848

4949
public function testHooksCreateResponseTypes(): void
5050
{
5151
$this->assertEachGetterValueIsString($this->createResponse, ['getReturnCode']);
52-
$this->assertEachGetterValueIsInteger($this->createResponse, ['getHookId']);
52+
$this->assertEachGetterValueIsString($this->createResponse, ['getHookId']);
5353
$this->assertEachGetterValueIsBoolean($this->createResponse, ['isPermanentHook', 'hasRawData']);
5454
}
5555
}

tests/unit/Responses/HooksListResponseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testHooksListResponseContent(): void
4747

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

6161
$this->assertEachGetterValueIsString($aHook, ['getCallbackUrl', 'getMeetingId']);
62-
$this->assertEachGetterValueIsInteger($aHook, ['getHookId']);
62+
$this->assertEachGetterValueIsString($aHook, ['getHookId']);
6363
$this->assertEachGetterValueIsBoolean($aHook, ['hasRawData', 'isPermanentHook']);
6464
}
6565
}

0 commit comments

Comments
 (0)