Subversion Repositories php-qbpwcf

Rev

Rev 3 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 1
<?php
2
 
3
namespace Ratchet\RFC6455\Test\Unit\Handshake;
4
 
5
use Ratchet\RFC6455\Handshake\ResponseVerifier;
6
use PHPUnit\Framework\TestCase;
7
 
8
/**
9
 * @covers Ratchet\RFC6455\Handshake\ResponseVerifier
10
 */
11
class ResponseVerifierTest extends TestCase {
12
    /**
13
     * @var ResponseVerifier
14
     */
15
    protected $_v;
16
 
17
    public function setUp() {
18
        $this->_v = new ResponseVerifier;
19
    }
20
 
21
    public static function subProtocolsProvider() {
22
        return [
23
            [true,  ['a'], ['a']]
24
          , [true,  ['c', 'd', 'a'], ['a']]
25
          , [true,  ['c, a', 'd'], ['a']]
26
          , [true,  [], []]
27
          , [true,  ['a', 'b'], []]
28
          , [false, ['c', 'd', 'a'], ['b', 'a']]
29
          , [false, ['a', 'b', 'c'], ['d']]
30
        ];
31
    }
32
 
33
    /**
34
     * @dataProvider subProtocolsProvider
35
     */
36
    public function testVerifySubProtocol($expected, $request, $response) {
37
        $this->assertEquals($expected, $this->_v->verifySubProtocol($request, $response));
38
    }
39
}