ikarusbot/vendor/ratchet/rfc6455/tests/unit/Handshake/ResponseVerifierTest.php

40 lines
985 B
PHP
Raw Normal View History

2025-01-10 19:52:34 +02:00
<?php
namespace Ratchet\RFC6455\Test\Unit\Handshake;
use Ratchet\RFC6455\Handshake\ResponseVerifier;
use PHPUnit\Framework\TestCase;
/**
* @covers Ratchet\RFC6455\Handshake\ResponseVerifier
*/
class ResponseVerifierTest extends TestCase {
/**
* @var ResponseVerifier
*/
protected $_v;
public function setUp() {
$this->_v = new ResponseVerifier;
}
public static function subProtocolsProvider() {
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($expected, $request, $response) {
$this->assertEquals($expected, $this->_v->verifySubProtocol($request, $response));
}
}