Merge branch 'master' into updated-docker

This commit is contained in:
Chris Boden 2021-12-08 09:12:39 -05:00
commit edd5ca364b
6 changed files with 59 additions and 44 deletions

43
.github/workflows/ci.yml vendored Normal file
View File

@ -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

View File

@ -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

View File

@ -1,6 +1,6 @@
# RFC6455 - The WebSocket Protocol # 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) [![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. This library a protocol handler for the RFC6455 specification.

View File

@ -12,11 +12,13 @@ class Message implements \IteratorAggregate, MessageInterface {
*/ */
private $len; private $len;
#[\ReturnTypeWillChange]
public function __construct() { public function __construct() {
$this->_frames = new \SplDoublyLinkedList; $this->_frames = new \SplDoublyLinkedList;
$this->len = 0; $this->len = 0;
} }
#[\ReturnTypeWillChange]
public function getIterator() { public function getIterator() {
return $this->_frames; return $this->_frames;
} }
@ -24,6 +26,7 @@ class Message implements \IteratorAggregate, MessageInterface {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
#[\ReturnTypeWillChange]
public function count() { public function count() {
return count($this->_frames); return count($this->_frames);
} }
@ -31,6 +34,7 @@ class Message implements \IteratorAggregate, MessageInterface {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
#[\ReturnTypeWillChange]
public function isCoalesced() { public function isCoalesced() {
if (count($this->_frames) == 0) { if (count($this->_frames) == 0) {
return false; return false;

View File

@ -1,14 +1,6 @@
set -x set -x
cd tests/ab 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 if [ "$ABTEST" = "client" ]; then
docker run --rm \ docker run --rm \
-d \ -d \
@ -44,7 +36,7 @@ if [ "$ABTEST" = "server" ]; then
fi fi
docker run --rm \ docker run --rm \
-it \ -i \
-v ${PWD}:/config \ -v ${PWD}:/config \
-v ${PWD}/reports:/reports \ -v ${PWD}/reports:/reports \
--name fuzzingclient \ --name fuzzingclient \
@ -54,5 +46,3 @@ if [ "$ABTEST" = "server" ]; then
# send the shutdown command to the PHP echo server # send the shutdown command to the PHP echo server
wget -O - -q http://127.0.0.1:9001/shutdown wget -O - -q http://127.0.0.1:9001/shutdown
fi fi

View File

@ -321,7 +321,11 @@ class MessageBufferTest extends TestCase
* @requires PHP 7.0 * @requires PHP 7.0
*/ */
public function testIniSizes($phpConfigurationValue, $expectedLimit) { 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( $messageBuffer = new MessageBuffer(
new CloseFrameChecker(), new CloseFrameChecker(),
function (Message $message) {}, function (Message $message) {},
@ -348,7 +352,11 @@ class MessageBufferTest extends TestCase
* @requires PHP 7.0 * @requires PHP 7.0
*/ */
public function testInvalidIniSize() { 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( $messageBuffer = new MessageBuffer(
new CloseFrameChecker(), new CloseFrameChecker(),
function (Message $message) {}, function (Message $message) {},