Skip to content

Commit df47257

Browse files
cluePaulRotmann
authored andcommitted
Ubuntu 24.04 and update test enviroment + PCOV to avoid segfault with
Xdebug 3.4.2
2 parents c1d0158 + f557f9a commit df47257

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
PHPUnit:
99
name: PHPUnit (PHP ${{ matrix.php }})
10-
runs-on: ubuntu-22.04
10+
runs-on: ubuntu-24.04
1111
strategy:
1212
matrix:
1313
php:
@@ -29,7 +29,7 @@ jobs:
2929
- uses: shivammathur/setup-php@v2
3030
with:
3131
php-version: ${{ matrix.php }}
32-
coverage: xdebug
32+
coverage: ${{ matrix.php < 8.0 && 'xdebug' || 'pcov' }}
3333
ini-file: development
3434
- run: composer install
3535
- run: docker pull busybox:latest

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
"php": ">=5.3",
1515
"clue/json-stream": "^0.1",
1616
"react/event-loop": "^1.2",
17-
"react/http": "^1.8",
18-
"react/promise": "^3.1 || ^2.11 || ^1.3",
17+
"react/http": "^1.11",
18+
"react/promise": "^3.2 || ^2.11 || ^1.3",
1919
"react/promise-stream": "^1.6",
20-
"react/socket": "^1.12",
21-
"react/stream": "^1.2",
20+
"react/socket": "^1.16",
21+
"react/stream": "^1.4",
2222
"rize/uri-template": "^0.3"
2323
},
2424
"require-dev": {
2525
"clue/caret-notation": "^0.2",
2626
"clue/tar-react": "^0.2",
2727
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36",
28-
"react/async": "^4 || ^3 || ^2"
28+
"react/async": "^4.2 || ^3 || ^2"
2929
},
3030
"autoload": {
3131
"psr-4": {

src/Client.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ class Client
5656
* @param ?string $url
5757
* @throws \InvalidArgumentException
5858
*/
59-
public function __construct(LoopInterface $loop = null, $url = null)
59+
public function __construct($loop = null, $url = null)
6060
{
61+
if ($loop !== null && !$loop instanceof LoopInterface) { // manual type check to support legacy PHP < 7.1
62+
throw new \InvalidArgumentException('Argument #1 ($loop) expected null|React\EventLoop\LoopInterface');
63+
}
64+
6165
if ($url === null) {
6266
$url = 'unix:///var/run/docker.sock';
6367
}

tests/ClientTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public function testCtorWithLoop()
5959
new Client($loop);
6060
}
6161

62+
public function testCtorThrowsForInvalidLoop()
63+
{
64+
$this->setExpectedException('InvalidArgumentException', 'Argument #1 ($loop) expected null|React\EventLoop\LoopInterface');
65+
new Client('loop');
66+
}
67+
6268
public function testCtorWithInvalidUrlThrows()
6369
{
6470
$this->setExpectedException('InvalidArgumentException');

tests/FunctionalClientTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,11 +478,9 @@ public function testCreateConnectDisconnectAndRemoveNetwork()
478478
$promise = $this->client->events($start, $end, array('network' => array($network['Id'])));
479479
$ret = \React\Async\await($promise);
480480

481-
// expects "create", "disconnect", "destroy" events ("connect" will be skipped because we don't start the container)
482-
$this->assertCount(3, $ret);
481+
$this->assertCount(2, $ret);
483482
$this->assertEquals('create', $ret[0]['Action']);
484-
$this->assertEquals('disconnect', $ret[1]['Action']);
485-
$this->assertEquals('destroy', $ret[2]['Action']);
483+
$this->assertEquals('destroy', $ret[1]['Action']);
486484
}
487485

488486
/**

0 commit comments

Comments
 (0)