|
@@ 50-71 (lines=22) @@
|
| 47 |
|
$this->assertEquals(null, $response->getRpcErrorData()); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
public function testConcatAsyncRequest() |
| 51 |
|
{ |
| 52 |
|
$id = 123; |
| 53 |
|
$method = 'concat'; |
| 54 |
|
$params = ['foo'=>'abc', 'bar'=>'def']; |
| 55 |
|
$request = $this->client->request($id, $method, $params); |
| 56 |
|
$promise = $this->client->sendAsync($request); |
| 57 |
|
|
| 58 |
|
$promise->then(function ($response) use ($request, $id, $method, $params) { |
| 59 |
|
$this->assertEquals(ClientInterface::SPEC, $request->getRpcVersion()); |
| 60 |
|
$this->assertEquals($id, $request->getRpcId()); |
| 61 |
|
$this->assertEquals($method, $request->getRpcMethod()); |
| 62 |
|
$this->assertEquals($params, $request->getRpcParams()); |
| 63 |
|
|
| 64 |
|
$this->assertEquals(ClientInterface::SPEC, $response->getRpcVersion()); |
| 65 |
|
$this->assertEquals(implode('', $params), $response->getRpcResult()); |
| 66 |
|
$this->assertEquals($id, $response->getRpcId()); |
| 67 |
|
$this->assertEquals(null, $response->getRpcErrorCode()); |
| 68 |
|
$this->assertEquals(null, $response->getRpcErrorMessage()); |
| 69 |
|
$this->assertEquals(null, $response->getRpcErrorData()); |
| 70 |
|
})->wait(); |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
public function testSumRequest() |
| 74 |
|
{ |
|
@@ 94-115 (lines=22) @@
|
| 91 |
|
$this->assertEquals(null, $response->getRpcErrorData()); |
| 92 |
|
} |
| 93 |
|
|
| 94 |
|
public function testSumAsyncRequest() |
| 95 |
|
{ |
| 96 |
|
$id = 'abc'; |
| 97 |
|
$method = 'sum'; |
| 98 |
|
$params = ['foo'=>123, 'bar'=>456]; |
| 99 |
|
$request = $this->client->request($id, $method, $params); |
| 100 |
|
$promise = $this->client->sendAsync($request); |
| 101 |
|
|
| 102 |
|
$promise->then(function ($response) use ($request, $id, $method, $params) { |
| 103 |
|
$this->assertEquals(ClientInterface::SPEC, $request->getRpcVersion()); |
| 104 |
|
$this->assertEquals($id, $request->getRpcId()); |
| 105 |
|
$this->assertEquals($method, $request->getRpcMethod()); |
| 106 |
|
$this->assertEquals($params, $request->getRpcParams()); |
| 107 |
|
|
| 108 |
|
$this->assertEquals(ClientInterface::SPEC, $response->getRpcVersion()); |
| 109 |
|
$this->assertEquals(array_sum($params), $response->getRpcResult()); |
| 110 |
|
$this->assertEquals($id, $response->getRpcId()); |
| 111 |
|
$this->assertEquals(null, $response->getRpcErrorCode()); |
| 112 |
|
$this->assertEquals(null, $response->getRpcErrorMessage()); |
| 113 |
|
$this->assertEquals(null, $response->getRpcErrorData()); |
| 114 |
|
})->wait(); |
| 115 |
|
} |
| 116 |
|
|
| 117 |
|
public function testFooRequest() |
| 118 |
|
{ |