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/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; diff --git a/tests/ab/run_ab_tests.sh b/tests/ab/run_ab_tests.sh index 1d8d0c1..3df4a7d 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 \ @@ -44,7 +36,7 @@ if [ "$ABTEST" = "server" ]; then fi docker run --rm \ - -it \ + -i \ -v ${PWD}:/config \ -v ${PWD}/reports:/reports \ --name fuzzingclient \ @@ -54,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 - - 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) {},