From 79c3dd392467b114b409c77c1e9a93ff6f9b2ffb Mon Sep 17 00:00:00 2001 From: Eirik Besteland <3kbest@gmail.com> Date: Sat, 20 Nov 2021 01:59:07 +0100 Subject: [PATCH 1/3] Add ReturnTypeWillChange attribute to silence PHP 8.1 deprecations --- src/Messaging/Message.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Messaging/Message.php b/src/Messaging/Message.php index 07c1fba..aea2050 100644 --- a/src/Messaging/Message.php +++ b/src/Messaging/Message.php @@ -12,11 +12,13 @@ class Message implements \IteratorAggregate, MessageInterface { */ private $len; + #[\ReturnTypeWillChange] public function __construct() { $this->_frames = new \SplDoublyLinkedList; $this->len = 0; } + #[\ReturnTypeWillChange] public function getIterator() { return $this->_frames; } @@ -24,6 +26,7 @@ class Message implements \IteratorAggregate, MessageInterface { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function count() { return count($this->_frames); } @@ -31,6 +34,7 @@ class Message implements \IteratorAggregate, MessageInterface { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function isCoalesced() { if (count($this->_frames) == 0) { return false; From 2b9a7d812ec5e3eb82c3a7635deb4537bec63b9f Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Mon, 6 Dec 2021 14:18:56 +0100 Subject: [PATCH 2/3] Use GitHub actions for continuous integration (CI) --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++ .travis.yml | 30 --------------- README.md | 2 +- tests/ab/run_ab_tests.sh | 8 ---- tests/unit/Messaging/MessageBufferTest.php | 12 +++++- 5 files changed, 54 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fb3698d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: CI + +on: + push: + pull_request: + +jobs: + PHPUnit: + name: PHPUnit (PHP ${{ matrix.php }})(${{ matrix.env }}) + runs-on: ubuntu-20.04 + strategy: + matrix: + env: + - client + - server + php: + - 7.4 + - 7.3 + - 7.2 + - 7.1 + - 7.0 + - 5.6 + steps: + - uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: xdebug + - run: docker pull crossbario/autobahn-testsuite + - run: composer install + + - run: sh tests/ab/run_ab_tests.sh + env: + ABTEST: ${{ matrix.env }} + SKIP_DEFLATE: _skip_deflate + if: ${{ matrix.php <= 5.6 }} + + - run: sh tests/ab/run_ab_tests.sh + env: + ABTEST: ${{ matrix.env }} + if: ${{ matrix.php >= 7.0 }} + - run: vendor/bin/phpunit --verbose diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f8f7b7c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: php - -services: docker - -php: - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - 7.3 - - 7.4 - - nightly - -env: - - ABTEST=client - - ABTEST=server - -matrix: - allow_failures: - - php: nightly - -before_install: - - docker pull crossbario/autobahn-testsuite - -before_script: - - composer install - - sh tests/ab/run_ab_tests.sh - -script: - - vendor/bin/phpunit diff --git a/README.md b/README.md index fba5093..1dfebf6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # RFC6455 - The WebSocket Protocol -[![Build Status](https://travis-ci.org/ratchetphp/RFC6455.svg?branch=master)](https://travis-ci.org/ratchetphp/RFC6455) +[![Build Status](https://github.com/ratchetphp/RFC6455/workflows/CI/badge.svg)](https://github.com/ratchetphp/RFC6455/actions) [![Autobahn Testsuite](https://img.shields.io/badge/Autobahn-passing-brightgreen.svg)](http://socketo.me/reports/rfc-server/index.html) This library a protocol handler for the RFC6455 specification. diff --git a/tests/ab/run_ab_tests.sh b/tests/ab/run_ab_tests.sh index b924480..ed5ca5a 100644 --- a/tests/ab/run_ab_tests.sh +++ b/tests/ab/run_ab_tests.sh @@ -1,14 +1,6 @@ set -x cd tests/ab -SKIP_DEFLATE= -if [ "$TRAVIS" = "true" ]; then -if [ $(phpenv version-name) = "hhvm" -o $(phpenv version-name) = "5.4" -o $(phpenv version-name) = "5.5" -o $(phpenv version-name) = "5.6" ]; then - echo "Skipping deflate autobahn tests for $(phpenv version-name)" - SKIP_DEFLATE=_skip_deflate -fi -fi - if [ "$ABTEST" = "client" ]; then docker run --rm \ -d \ diff --git a/tests/unit/Messaging/MessageBufferTest.php b/tests/unit/Messaging/MessageBufferTest.php index 75d790b..89dcca0 100644 --- a/tests/unit/Messaging/MessageBufferTest.php +++ b/tests/unit/Messaging/MessageBufferTest.php @@ -321,7 +321,11 @@ class MessageBufferTest extends TestCase * @requires PHP 7.0 */ public function testIniSizes($phpConfigurationValue, $expectedLimit) { - ini_set('memory_limit', $phpConfigurationValue); + $value = @ini_set('memory_limit', $phpConfigurationValue); + if ($value === false) { + $this->markTestSkipped("Does not support setting the memory_limit lower than current memory_usage"); + } + $messageBuffer = new MessageBuffer( new CloseFrameChecker(), function (Message $message) {}, @@ -348,7 +352,11 @@ class MessageBufferTest extends TestCase * @requires PHP 7.0 */ public function testInvalidIniSize() { - ini_set('memory_limit', 'lots of memory'); + $value = @ini_set('memory_limit', 'lots of memory'); + if ($value === false) { + $this->markTestSkipped("Does not support setting the memory_limit lower than current memory_usage"); + } + $messageBuffer = new MessageBuffer( new CloseFrameChecker(), function (Message $message) {}, From 30f6b14634a44cd3381c1038c8570a8a1a585b94 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Tue, 7 Dec 2021 16:56:09 +0100 Subject: [PATCH 3/3] Fix docker command to run server tests with GitHub actions --- tests/ab/run_ab_tests.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/ab/run_ab_tests.sh b/tests/ab/run_ab_tests.sh index ed5ca5a..9c50d66 100644 --- a/tests/ab/run_ab_tests.sh +++ b/tests/ab/run_ab_tests.sh @@ -36,7 +36,7 @@ if [ "$ABTEST" = "server" ]; then fi docker run --rm \ - -it \ + -i \ -v ${PWD}:/config \ -v ${PWD}/reports:/reports \ --name fuzzingclient \ @@ -46,5 +46,3 @@ if [ "$ABTEST" = "server" ]; then # send the shutdown command to the PHP echo server wget -O - -q http://127.0.0.1:9001/shutdown fi - -