|
@@ 71-83 (lines=13) @@
|
| 68 |
|
$this->assertSame($request, $this->client->notification('foo', ['bar'=>true])); |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
public function testRequest() |
| 72 |
|
{ |
| 73 |
|
$request = $this->mockRequest(); |
| 74 |
|
$jsonrpc = ['jsonrpc'=>ClientInterface::SPEC, 'method'=>'foo', 'id'=>123]; |
| 75 |
|
$type = RequestInterface::REQUEST; |
| 76 |
|
$uri = 'http://foo'; |
| 77 |
|
|
| 78 |
|
$this->httpClient->shouldReceive('getConfig')->once()->with('base_uri')->andReturn($uri); |
| 79 |
|
$this->httpClient->shouldReceive('getConfig')->once()->with('defaults')->andReturn([]); |
| 80 |
|
$this->messageFactory->shouldReceive('createRequest')->once()->with($type, $uri, [], $jsonrpc)->andReturn($request); |
| 81 |
|
|
| 82 |
|
$this->assertSame($request, $this->client->request(123, 'foo')); |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
public function testRequestWithParams() |
| 86 |
|
{ |
|
@@ 99-111 (lines=13) @@
|
| 96 |
|
$this->assertSame($request, $this->client->request(123, 'foo', ['bar'=>true])); |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
public function testRequestWithEmptyParams() |
| 100 |
|
{ |
| 101 |
|
$request = $this->mockRequest(); |
| 102 |
|
$jsonrpc = ['jsonrpc'=>ClientInterface::SPEC, 'method'=>'foo', 'id'=>123]; |
| 103 |
|
$type = RequestInterface::REQUEST; |
| 104 |
|
$uri = 'http://foo'; |
| 105 |
|
|
| 106 |
|
$this->httpClient->shouldReceive('getConfig')->once()->with('base_uri')->andReturn($uri); |
| 107 |
|
$this->httpClient->shouldReceive('getConfig')->once()->with('defaults')->andReturn([]); |
| 108 |
|
$this->messageFactory->shouldReceive('createRequest')->once()->with($type, $uri, [], $jsonrpc)->andReturn($request); |
| 109 |
|
|
| 110 |
|
$this->assertSame($request, $this->client->request(123, 'foo', [])); |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
public function testSendNotification() |
| 114 |
|
{ |