Skip to content

Commit b51de21

Browse files
authored
Merge pull request #185 from WyriHaximus-secret-labs/1.x-PHP8.5
[1.x] Improve PHP 8.5+ support by avoiding deprecated method calls in tests
2 parents f74e565 + e139356 commit b51de21

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
php:
14+
- 8.5
1415
- 8.4
1516
- 8.3
1617
- 8.2
@@ -47,7 +48,7 @@ jobs:
4748
- uses: actions/checkout@v4
4849
- uses: shivammathur/setup-php@v2
4950
with:
50-
php-version: 8.4
51+
php-version: 8.5
5152
coverage: xdebug
5253
ini-file: development
5354
- run: composer install

‎tests/DuplexResourceStreamTest.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ public function testConstructWithoutLoopAssignsLoopAutomatically()
2727
$stream = new DuplexResourceStream($resource);
2828

2929
$ref = new \ReflectionProperty($stream, 'loop');
30-
$ref->setAccessible(true);
30+
if (PHP_VERSION_ID < 80100) {
31+
$ref->setAccessible(true);
32+
}
3133
$loop = $ref->getValue($stream);
3234

3335
$this->assertInstanceOf('React\EventLoop\LoopInterface', $loop);

‎tests/ReadableResourceStreamTest.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ public function testConstructWithoutLoopAssignsLoopAutomatically()
2626
$stream = new ReadableResourceStream($resource);
2727

2828
$ref = new \ReflectionProperty($stream, 'loop');
29-
$ref->setAccessible(true);
29+
if (PHP_VERSION_ID < 80100) {
30+
$ref->setAccessible(true);
31+
}
3032
$loop = $ref->getValue($stream);
3133

3234
$this->assertInstanceOf('React\EventLoop\LoopInterface', $loop);

‎tests/WritableResourceStreamTest.php‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ public function testConstructWithoutLoopAssignsLoopAutomatically()
2626
$stream = new WritableResourceStream($resource);
2727

2828
$ref = new \ReflectionProperty($stream, 'loop');
29-
$ref->setAccessible(true);
29+
if (PHP_VERSION_ID < 80100) {
30+
$ref->setAccessible(true);
31+
}
3032
$loop = $ref->getValue($stream);
3133

3234
$this->assertInstanceOf('React\EventLoop\LoopInterface', $loop);
@@ -472,6 +474,10 @@ public function testDoubleCloseWillEmitOnlyOnce()
472474
*/
473475
public function testWritingToClosedWritableResourceStreamShouldNotWriteToStream()
474476
{
477+
if (PHP_VERSION_ID >= 80500) {
478+
$this->markTestSkipped('Since PHP 8.5 attempting to write to a closed stream will result in an error');
479+
}
480+
475481
$stream = fopen('php://temp', 'r+');
476482
$filterBuffer = '';
477483
$loop = $this->createLoopMock();

0 commit comments

Comments
 (0)