From 24341b3c9b78957c3d179663c7bf207df04153e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Mon, 25 May 2026 22:30:38 +0200 Subject: [PATCH] Run tests on PHP 8.5 and update test environment --- .github/workflows/ci.yml | 5 +++-- tests/unit/Messaging/FrameTest.php | 16 ++++++++++++---- tests/unit/Messaging/MessageBufferTest.php | 20 +++++++++++++++----- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 474b1c8..46e7bed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: os: - - ubuntu-22.04 + - ubuntu-24.04 env: - client - server @@ -22,8 +22,9 @@ jobs: - 8.2 - 8.3 - 8.4 + - 8.5 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 with: diff --git a/tests/unit/Messaging/FrameTest.php b/tests/unit/Messaging/FrameTest.php index ced09b8..5b286bc 100644 --- a/tests/unit/Messaging/FrameTest.php +++ b/tests/unit/Messaging/FrameTest.php @@ -162,14 +162,18 @@ public function testFirstPayloadDesignationValue(int $bits, string $bin): void { $this->_frame->addBuffer(static::encode($bin)); $ref = new \ReflectionClass($this->_frame); $cb = $ref->getMethod('getFirstPayloadVal'); - $cb->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $cb->setAccessible(true); + } $this->assertEquals(bindec($bin), $cb->invoke($this->_frame)); } public function testFirstPayloadValUnderflow(): void { $ref = new \ReflectionClass($this->_frame); $cb = $ref->getMethod('getFirstPayloadVal'); - $cb->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $cb->setAccessible(true); + } $this->expectException(\UnderflowException::class); $cb->invoke($this->_frame); } @@ -182,14 +186,18 @@ public function testDetermineHowManyBitsAreUsedToDescribePayload(int $expected_b $this->_frame->addBuffer(static::encode($bin)); $ref = new \ReflectionClass($this->_frame); $cb = $ref->getMethod('getNumPayloadBits'); - $cb->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $cb->setAccessible(true); + } $this->assertEquals($expected_bits, $cb->invoke($this->_frame)); } public function testgetNumPayloadBitsUnderflow(): void { $ref = new \ReflectionClass($this->_frame); $cb = $ref->getMethod('getNumPayloadBits'); - $cb->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $cb->setAccessible(true); + } $this->expectException(\UnderflowException::class); $cb->invoke($this->_frame); } diff --git a/tests/unit/Messaging/MessageBufferTest.php b/tests/unit/Messaging/MessageBufferTest.php index b3a9eef..6383774 100644 --- a/tests/unit/Messaging/MessageBufferTest.php +++ b/tests/unit/Messaging/MessageBufferTest.php @@ -263,7 +263,9 @@ function (Frame $frame) use (&$controlFrame): void { */ public function testMemoryLimits(string $phpConfigurationValue, int $expectedLimit): void { $method = new \ReflectionMethod(MessageBuffer::class, 'getMemoryLimit'); - $method->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $method->setAccessible(true); + } $actualLimit = $method->invoke(null, $phpConfigurationValue); $this->assertSame($expectedLimit, $actualLimit); @@ -339,11 +341,15 @@ static function (Frame $frame): void {}, } $prop = new \ReflectionProperty($messageBuffer, 'maxMessagePayloadSize'); - $prop->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $prop->setAccessible(true); + } $this->assertEquals($expectedLimit / 4, $prop->getValue($messageBuffer)); $prop = new \ReflectionProperty($messageBuffer, 'maxFramePayloadSize'); - $prop->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $prop->setAccessible(true); + } $this->assertEquals($expectedLimit / 4, $prop->getValue($messageBuffer)); } @@ -365,11 +371,15 @@ function (Frame $frame) {}, ); $prop = new \ReflectionProperty($messageBuffer, 'maxMessagePayloadSize'); - $prop->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $prop->setAccessible(true); + } $this->assertEquals(0, $prop->getValue($messageBuffer)); $prop = new \ReflectionProperty($messageBuffer, 'maxFramePayloadSize'); - $prop->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $prop->setAccessible(true); + } $this->assertEquals(0, $prop->getValue($messageBuffer)); } }