|
@@ 141-161 (lines=21) @@
|
| 138 |
|
$this->assertEquals(null, $response->getRpcErrorData()); |
| 139 |
|
} |
| 140 |
|
|
| 141 |
|
public function testFooAsyncRequest() |
| 142 |
|
{ |
| 143 |
|
$id = 'abc'; |
| 144 |
|
$method = 'foo'; |
| 145 |
|
$request = $this->client->request($id, $method, []); |
| 146 |
|
$this->promise = $this->client->sendAsync($request); |
| 147 |
|
|
| 148 |
|
$this->promise->then(function ($response) use ($request, $id, $method) { |
| 149 |
|
$this->assertEquals(ClientInterface::SPEC, $request->getRpcVersion()); |
| 150 |
|
$this->assertEquals($id, $request->getRpcId()); |
| 151 |
|
$this->assertEquals($method, $request->getRpcMethod()); |
| 152 |
|
$this->assertEquals(null, $request->getRpcParams()); |
| 153 |
|
|
| 154 |
|
$this->assertEquals(ClientInterface::SPEC, $response->getRpcVersion()); |
| 155 |
|
$this->assertEquals('foo', $response->getRpcResult()); |
| 156 |
|
$this->assertEquals($id, $response->getRpcId()); |
| 157 |
|
$this->assertEquals(null, $response->getRpcErrorCode()); |
| 158 |
|
$this->assertEquals(null, $response->getRpcErrorMessage()); |
| 159 |
|
$this->assertEquals(null, $response->getRpcErrorData()); |
| 160 |
|
}); |
| 161 |
|
} |
| 162 |
|
|
| 163 |
|
public function testBarRequest() |
| 164 |
|
{ |
|
@@ 183-203 (lines=21) @@
|
| 180 |
|
$this->assertEquals(null, $response->getRpcErrorData()); |
| 181 |
|
} |
| 182 |
|
|
| 183 |
|
public function testBarAsyncRequest() |
| 184 |
|
{ |
| 185 |
|
$id = 'abc'; |
| 186 |
|
$method = 'bar'; |
| 187 |
|
$request = $this->client->request($id, $method, []); |
| 188 |
|
$this->promise = $this->client->sendAsync($request); |
| 189 |
|
|
| 190 |
|
$this->promise->then(function ($response) use ($request, $id, $method) { |
| 191 |
|
$this->assertEquals(ClientInterface::SPEC, $request->getRpcVersion()); |
| 192 |
|
$this->assertEquals($id, $request->getRpcId()); |
| 193 |
|
$this->assertEquals($method, $request->getRpcMethod()); |
| 194 |
|
$this->assertEquals(null, $request->getRpcParams()); |
| 195 |
|
|
| 196 |
|
$this->assertEquals(ClientInterface::SPEC, $response->getRpcVersion()); |
| 197 |
|
$this->assertEquals(null, $response->getRpcResult()); |
| 198 |
|
$this->assertEquals($id, $response->getRpcId()); |
| 199 |
|
$this->assertTrue(is_int($response->getRpcErrorCode())); |
| 200 |
|
$this->assertTrue(is_string($response->getRpcErrorMessage())); |
| 201 |
|
$this->assertEquals(null, $response->getRpcErrorData()); |
| 202 |
|
}); |
| 203 |
|
} |
| 204 |
|
|
| 205 |
|
public function testBarRequestThrows() |
| 206 |
|
{ |