rfc6455/tests/unit/Handshake/ResponseVerifierTest.php
Mohamad Faeez 7597a8c00a
Some checks are pending
CI / PHPUnit (PHP ${{ matrix.php }})(${{ matrix.env }}) on ${{ matrix.os }} (client, ubuntu-22.04, 7.4) (push) Waiting to run
CI / PHPUnit (PHP ${{ matrix.php }})(${{ matrix.env }}) on ${{ matrix.os }} (client, ubuntu-22.04, 8) (push) Waiting to run
CI / PHPUnit (PHP ${{ matrix.php }})(${{ matrix.env }}) on ${{ matrix.os }} (client, ubuntu-22.04, 8.1) (push) Waiting to run
CI / PHPUnit (PHP ${{ matrix.php }})(${{ matrix.env }}) on ${{ matrix.os }} (client, ubuntu-22.04, 8.2) (push) Waiting to run
CI / PHPUnit (PHP ${{ matrix.php }})(${{ matrix.env }}) on ${{ matrix.os }} (client, ubuntu-22.04, 8.3) (push) Waiting to run
CI / PHPUnit (PHP ${{ matrix.php }})(${{ matrix.env }}) on ${{ matrix.os }} (client, ubuntu-22.04, 8.4) (push) Waiting to run
CI / PHPUnit (PHP ${{ matrix.php }})(${{ matrix.env }}) on ${{ matrix.os }} (server, ubuntu-22.04, 7.4) (push) Waiting to run
CI / PHPUnit (PHP ${{ matrix.php }})(${{ matrix.env }}) on ${{ matrix.os }} (server, ubuntu-22.04, 8) (push) Waiting to run
CI / PHPUnit (PHP ${{ matrix.php }})(${{ matrix.env }}) on ${{ matrix.os }} (server, ubuntu-22.04, 8.1) (push) Waiting to run
CI / PHPUnit (PHP ${{ matrix.php }})(${{ matrix.env }}) on ${{ matrix.os }} (server, ubuntu-22.04, 8.2) (push) Waiting to run
CI / PHPUnit (PHP ${{ matrix.php }})(${{ matrix.env }}) on ${{ matrix.os }} (server, ubuntu-22.04, 8.3) (push) Waiting to run
CI / PHPUnit (PHP ${{ matrix.php }})(${{ matrix.env }}) on ${{ matrix.os }} (server, ubuntu-22.04, 8.4) (push) Waiting to run
Update namespace
2025-04-09 14:54:27 +08:00

40 lines
1.0 KiB
PHP

<?php
namespace mfmdevsystem\RFC6455\Test\Unit\Handshake;
use mfmdevsystem\RFC6455\Handshake\ResponseVerifier;
use PHPUnit\Framework\TestCase;
/**
* @covers mfmdevsystem\RFC6455\Handshake\ResponseVerifier
*/
class ResponseVerifierTest extends TestCase {
/**
* @var ResponseVerifier
*/
protected $_v;
protected function setUp(): void {
$this->_v = new ResponseVerifier;
}
public static function subProtocolsProvider(): array {
return [
[true, ['a'], ['a']]
, [true, ['c', 'd', 'a'], ['a']]
, [true, ['c, a', 'd'], ['a']]
, [true, [], []]
, [true, ['a', 'b'], []]
, [false, ['c', 'd', 'a'], ['b', 'a']]
, [false, ['a', 'b', 'c'], ['d']]
];
}
/**
* @dataProvider subProtocolsProvider
*/
public function testVerifySubProtocol(bool $expected, array $request, array $response): void {
$this->assertEquals($expected, $this->_v->verifySubProtocol($request, $response));
}
}