From 37617484b6702586e1b0bd9367782428c36f2911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Fri, 18 Apr 2025 10:48:38 +0200 Subject: [PATCH 1/3] Update test environment to fix running tests on GitHub Actions --- .github/workflows/ci.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa12b680..a0c9bf06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,17 +1,13 @@ name: "CI" on: - pull_request: push: - branches: - - "master" - schedule: - - cron: "42 3 * * *" + pull_request: jobs: phpunit: name: "PHPUnit" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-24.04" strategy: matrix: @@ -32,7 +28,7 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" with: fetch-depth: 2 @@ -44,7 +40,7 @@ jobs: ini-values: "zend.assertions=1" - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v1" + uses: "ramsey/composer-install@v3" with: dependency-versions: "${{ matrix.dependencies }}" From b53888ea9bf2eac9501c5ad767ec1f363513751f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Fri, 11 Aug 2023 12:14:43 +0200 Subject: [PATCH 2/3] Temporarily pin psr/http-message to ~1.0.1 to fix tests on PHP 7.2+ --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1dffae6b..ba788169 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,7 @@ , "symfony/routing": "^2.6|^3.0|^4.0|^5.0|^6.0" } , "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.8", + "psr/http-message": "~1.0.1" } } From 0cc24c57e510d722314fc5f7440f86af2f8dc3b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Fri, 11 Aug 2023 12:01:55 +0200 Subject: [PATCH 3/3] Skip tests requiring ext-sockets or error_reporting when not set up --- tests/unit/AbstractConnectionDecoratorTest.php | 12 ++++++++++++ tests/unit/Server/IoServerTest.php | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/tests/unit/AbstractConnectionDecoratorTest.php b/tests/unit/AbstractConnectionDecoratorTest.php index 0887d3e9..87c46ff8 100644 --- a/tests/unit/AbstractConnectionDecoratorTest.php +++ b/tests/unit/AbstractConnectionDecoratorTest.php @@ -131,16 +131,28 @@ public function testDecoratorRecursionLevel2() { } public function testWarningGettingNothing() { + if (!(error_reporting() & E_NOTICE)) { + $this->markTestSkipped('Requires error_reporting to include E_NOTICE'); + } + $this->setExpectedException('PHPUnit_Framework_Error'); $var = $this->mock->nonExistant; } public function testWarningGettingNothingLevel1() { + if (!(error_reporting() & E_NOTICE)) { + $this->markTestSkipped('Requires error_reporting to include E_NOTICE'); + } + $this->setExpectedException('PHPUnit_Framework_Error'); $var = $this->l1->nonExistant; } public function testWarningGettingNothingLevel2() { + if (!(error_reporting() & E_NOTICE)) { + $this->markTestSkipped('Requires error_reporting to include E_NOTICE'); + } + $this->setExpectedException('PHPUnit_Framework_Error'); $var = $this->l2->nonExistant; } diff --git a/tests/unit/Server/IoServerTest.php b/tests/unit/Server/IoServerTest.php index e20115f2..6d7936db 100644 --- a/tests/unit/Server/IoServerTest.php +++ b/tests/unit/Server/IoServerTest.php @@ -47,6 +47,9 @@ public function testOnOpen() { //$this->assertTrue(is_int($this->app->last['onOpen'][0]->resourceId)); } + /** + * @requires extension sockets + */ public function testOnData() { $msg = 'Hello World!'; @@ -73,6 +76,9 @@ public function testOnData() { $this->tickLoop($this->server->loop); } + /** + * @requires extension sockets + */ public function testOnClose() { $this->app->expects($this->once())->method('onClose')->with($this->isInstanceOf('\\Ratchet\\ConnectionInterface'));