|
@@ 80-92 (lines=13) @@
|
| 77 |
|
$this->assertSame($request, $this->client->notification('foo', ['bar'=>true])); |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
public function testRequest() |
| 81 |
|
{ |
| 82 |
|
$request = $this->mockRequest(); |
| 83 |
|
$jsonrpc = ['jsonrpc'=>ClientInterface::SPEC, 'method'=>'foo', 'id'=>123]; |
| 84 |
|
$type = RequestInterface::REQUEST; |
| 85 |
|
$uri = 'http://foo'; |
| 86 |
|
|
| 87 |
|
$this->httpClient->shouldReceive('getConfig')->once()->with('base_uri')->andReturn($uri); |
| 88 |
|
$this->httpClient->shouldReceive('getConfig')->once()->with('defaults')->andReturn([]); |
| 89 |
|
$this->messageFactory->shouldReceive('createRequest')->once()->with($type, $uri, [], $jsonrpc)->andReturn($request); |
| 90 |
|
|
| 91 |
|
$this->assertSame($request, $this->client->request(123, 'foo')); |
| 92 |
|
} |
| 93 |
|
|
| 94 |
|
public function testRequestWithParams() |
| 95 |
|
{ |
|
@@ 108-120 (lines=13) @@
|
| 105 |
|
$this->assertSame($request, $this->client->request(123, 'foo', ['bar'=>true])); |
| 106 |
|
} |
| 107 |
|
|
| 108 |
|
public function testRequestWithEmptyParams() |
| 109 |
|
{ |
| 110 |
|
$request = $this->mockRequest(); |
| 111 |
|
$jsonrpc = ['jsonrpc'=>ClientInterface::SPEC, 'method'=>'foo', 'id'=>123]; |
| 112 |
|
$type = RequestInterface::REQUEST; |
| 113 |
|
$uri = 'http://foo'; |
| 114 |
|
|
| 115 |
|
$this->httpClient->shouldReceive('getConfig')->once()->with('base_uri')->andReturn($uri); |
| 116 |
|
$this->httpClient->shouldReceive('getConfig')->once()->with('defaults')->andReturn([]); |
| 117 |
|
$this->messageFactory->shouldReceive('createRequest')->once()->with($type, $uri, [], $jsonrpc)->andReturn($request); |
| 118 |
|
|
| 119 |
|
$this->assertSame($request, $this->client->request(123, 'foo', [])); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
public function testSendNotification() |
| 123 |
|
{ |