From 3928b1dcc62cf4a93e2ce76cbc202bb4ef69c4e6 Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Tue, 21 Jul 2026 09:38:47 +0200 Subject: [PATCH] Fix invalid hook type --- src/Core/Hook.php | 6 +++--- src/Responses/HooksCreateResponse.php | 4 ++-- tests/fixtures/hooks_create.xml | 4 ++-- tests/fixtures/hooks_create_existing.xml | 4 ++-- tests/fixtures/hooks_list.xml | 6 +++--- tests/unit/BigBlueButtonTest.php | 12 ++++++------ tests/unit/Parameters/HooksDestroyParametersTest.php | 2 +- tests/unit/Responses/HooksCreateResponseTest.php | 4 ++-- tests/unit/Responses/HooksListResponseTest.php | 4 ++-- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/Core/Hook.php b/src/Core/Hook.php index 5cda828c..fb05fe2a 100644 --- a/src/Core/Hook.php +++ b/src/Core/Hook.php @@ -27,7 +27,7 @@ */ class Hook { - private readonly int $hookId; + private readonly string $hookId; private readonly string $meetingId; @@ -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; } diff --git a/src/Responses/HooksCreateResponse.php b/src/Responses/HooksCreateResponse.php index 7290d2db..e562378f 100644 --- a/src/Responses/HooksCreateResponse.php +++ b/src/Responses/HooksCreateResponse.php @@ -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 diff --git a/tests/fixtures/hooks_create.xml b/tests/fixtures/hooks_create.xml index 5e97adf7..e83a70a3 100644 --- a/tests/fixtures/hooks_create.xml +++ b/tests/fixtures/hooks_create.xml @@ -1,6 +1,6 @@ SUCCESS - 1 + 12345678-1234-5678-1234-567812345678 false false - \ No newline at end of file + diff --git a/tests/fixtures/hooks_create_existing.xml b/tests/fixtures/hooks_create_existing.xml index 62ec9760..0e032676 100644 --- a/tests/fixtures/hooks_create_existing.xml +++ b/tests/fixtures/hooks_create_existing.xml @@ -1,6 +1,6 @@ SUCCESS - 1 + 12345678-1234-5678-1234-567812345678 duplicateWarning There is already a hook for this callback URL. - \ No newline at end of file + diff --git a/tests/fixtures/hooks_list.xml b/tests/fixtures/hooks_list.xml index 9e8fc9b8..9a679885 100644 --- a/tests/fixtures/hooks_list.xml +++ b/tests/fixtures/hooks_list.xml @@ -2,17 +2,17 @@ SUCCESS - 1 + 12345678-1234-5678-1234-567812345678 false false - 2 + 23456789-1234-5678-1234-567812345678 false false - \ No newline at end of file + diff --git a/tests/unit/BigBlueButtonTest.php b/tests/unit/BigBlueButtonTest.php index c08f8f46..4410d474 100644 --- a/tests/unit/BigBlueButtonTest.php +++ b/tests/unit/BigBlueButtonTest.php @@ -687,7 +687,7 @@ public function testHooksCreate(): void $xml = ' SUCCESS - 1 + 12345678-1234-5678-1234-567812345678 false false '; @@ -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()); } @@ -710,14 +710,14 @@ public function testHooksList(): void SUCCESS - 1 + 12345678-1234-5678-1234-567812345678 false false - 2 + 23456789-1234-5678-1234-567812345678 false false @@ -734,7 +734,7 @@ 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()); @@ -742,7 +742,7 @@ public function testHooksList(): void // 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()); diff --git a/tests/unit/Parameters/HooksDestroyParametersTest.php b/tests/unit/Parameters/HooksDestroyParametersTest.php index aa3ea0ff..a3138bf9 100644 --- a/tests/unit/Parameters/HooksDestroyParametersTest.php +++ b/tests/unit/Parameters/HooksDestroyParametersTest.php @@ -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()); } diff --git a/tests/unit/Responses/HooksCreateResponseTest.php b/tests/unit/Responses/HooksCreateResponseTest.php index 77a35d1a..e5067ce3 100644 --- a/tests/unit/Responses/HooksCreateResponseTest.php +++ b/tests/unit/Responses/HooksCreateResponseTest.php @@ -41,7 +41,7 @@ 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()); } @@ -49,7 +49,7 @@ public function testHooksCreateResponseContent(): void 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']); } } diff --git a/tests/unit/Responses/HooksListResponseTest.php b/tests/unit/Responses/HooksListResponseTest.php index 8395fd19..0b960fd3 100644 --- a/tests/unit/Responses/HooksListResponseTest.php +++ b/tests/unit/Responses/HooksListResponseTest.php @@ -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()); } @@ -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']); } }