Completed
Push — guzzle-5 ( 0ecdde...1d908f )
by Harry
04:32
created

testSubscribersGetAddedToTheHttpClient()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
rs 9.3142
cc 1
eloc 13
nc 1
nop 0
1
<?php
2
/*
3
 * This file is part of Guzzle HTTP JSON-RPC
4
 *
5
 * Copyright (c) 2014 Nature Delivered Ltd. <http://graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @see  http://github.com/graze/guzzle-jsonrpc/blob/master/LICENSE
11
 * @link http://github.com/graze/guzzle-jsonrpc
12
 */
13
14
namespace Graze\GuzzleHttp\JsonRpc;
15
16
use Graze\GuzzleHttp\JsonRpc\Subscriber\ErrorSubscriber;
17
use Graze\GuzzleHttp\JsonRpc\Test\FunctionalTestCase;
18
19
class SubscribersFunctionalTest extends FunctionalTestCase
20
{
21
    /**
22
     * @expectedException \Graze\GuzzleHttp\JsonRpc\Exception\ClientException
23
     */
24
    public function testSubscribersGetAddedToTheHttpClient()
25
    {
26
        $subscriber = new ErrorSubscriber();
27
        $client = $this->createClient(
28
            null,
29
            [
30
                'subscribers' => [$subscriber],
31
            ]
32
        );
33
34
        $id = 'abc';
35
        $method = 'bar';
36
        $request = $client->request($id, $method, []);
37
38
        $this->assertEquals(ClientInterface::SPEC, $request->getRpcVersion());
39
        $this->assertEquals($id, $request->getRpcId());
40
        $this->assertEquals($method, $request->getRpcMethod());
41
        $this->assertEquals(null, $request->getRpcParams());
42
43
        $client->send($request);
44
    }
45
}
46