Skip to content

Commit fbbee0a

Browse files
authored
Merge pull request #186 from WyriHaximus-secret-labs/3.x-PHP8.5
[3.x] Improve PHP 8.5+ support by avoiding deprecated method calls in tests
2 parents 430a9df + 9f7df57 commit fbbee0a

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
@@ -42,7 +43,7 @@ jobs:
4243
- uses: actions/checkout@v4
4344
- uses: shivammathur/setup-php@v2
4445
with:
45-
php-version: 8.2
46+
php-version: 8.5
4647
coverage: xdebug
4748
ini-file: development
4849
- run: composer install

‎tests/DuplexResourceStreamTest.php‎

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

3535
$ref = new \ReflectionProperty($stream, 'loop');
36-
$ref->setAccessible(true);
36+
if (PHP_VERSION_ID < 80100) {
37+
$ref->setAccessible(true);
38+
}
3739
$loop = $ref->getValue($stream);
3840

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

‎tests/ReadableResourceStreamTest.php‎

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

3434
$ref = new \ReflectionProperty($stream, 'loop');
35-
$ref->setAccessible(true);
35+
if (PHP_VERSION_ID < 80100) {
36+
$ref->setAccessible(true);
37+
}
3638
$loop = $ref->getValue($stream);
3739

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

‎tests/WritableResourceStreamTest.php‎

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

3333
$ref = new \ReflectionProperty($stream, 'loop');
34-
$ref->setAccessible(true);
34+
if (PHP_VERSION_ID < 80100) {
35+
$ref->setAccessible(true);
36+
}
3537
$loop = $ref->getValue($stream);
3638

3739
$this->assertInstanceOf('React\EventLoop\LoopInterface', $loop);
@@ -509,6 +511,10 @@ public function testDoubleCloseWillEmitOnlyOnce(): void
509511
*/
510512
public function testWritingToClosedWritableResourceStreamShouldNotWriteToStream(): void
511513
{
514+
if (PHP_VERSION_ID >= 80500) {
515+
$this->markTestSkipped('Since PHP 8.5 attempting to write to a closed stream will result in an error');
516+
}
517+
512518
$stream = fopen('php://temp', 'r+');
513519
assert(is_resource($stream));
514520

0 commit comments

Comments
 (0)