|
@@ 29-48 (lines=20) @@
|
| 26 |
|
$this->client = $this->createClient(); |
| 27 |
|
} |
| 28 |
|
|
| 29 |
|
public function testConcatRequest() |
| 30 |
|
{ |
| 31 |
|
$id = 123; |
| 32 |
|
$method = 'concat'; |
| 33 |
|
$params = ['foo'=>'abc', 'bar'=>'def']; |
| 34 |
|
$request = $this->client->request($id, $method, $params); |
| 35 |
|
$response = $this->client->send($request); |
| 36 |
|
|
| 37 |
|
$this->assertEquals(ClientInterface::SPEC, $request->getRpcVersion()); |
| 38 |
|
$this->assertEquals($id, $request->getRpcId()); |
| 39 |
|
$this->assertEquals($method, $request->getRpcMethod()); |
| 40 |
|
$this->assertEquals($params, $request->getRpcParams()); |
| 41 |
|
|
| 42 |
|
$this->assertEquals(ClientInterface::SPEC, $response->getRpcVersion()); |
| 43 |
|
$this->assertEquals(implode('', $params), $response->getRpcResult()); |
| 44 |
|
$this->assertEquals($id, $response->getRpcId()); |
| 45 |
|
$this->assertEquals(null, $response->getRpcErrorCode()); |
| 46 |
|
$this->assertEquals(null, $response->getRpcErrorMessage()); |
| 47 |
|
$this->assertEquals(null, $response->getRpcErrorData()); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
public function testConcatAsyncRequest() |
| 51 |
|
{ |
|
@@ 73-92 (lines=20) @@
|
| 70 |
|
})->wait(); |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
public function testSumRequest() |
| 74 |
|
{ |
| 75 |
|
$id = 'abc'; |
| 76 |
|
$method = 'sum'; |
| 77 |
|
$params = ['foo'=>123, 'bar'=>456]; |
| 78 |
|
$request = $this->client->request($id, $method, $params); |
| 79 |
|
$response = $this->client->send($request); |
| 80 |
|
|
| 81 |
|
$this->assertEquals(ClientInterface::SPEC, $request->getRpcVersion()); |
| 82 |
|
$this->assertEquals($id, $request->getRpcId()); |
| 83 |
|
$this->assertEquals($method, $request->getRpcMethod()); |
| 84 |
|
$this->assertEquals($params, $request->getRpcParams()); |
| 85 |
|
|
| 86 |
|
$this->assertEquals(ClientInterface::SPEC, $response->getRpcVersion()); |
| 87 |
|
$this->assertEquals(array_sum($params), $response->getRpcResult()); |
| 88 |
|
$this->assertEquals($id, $response->getRpcId()); |
| 89 |
|
$this->assertEquals(null, $response->getRpcErrorCode()); |
| 90 |
|
$this->assertEquals(null, $response->getRpcErrorMessage()); |
| 91 |
|
$this->assertEquals(null, $response->getRpcErrorData()); |
| 92 |
|
} |
| 93 |
|
|
| 94 |
|
public function testSumAsyncRequest() |
| 95 |
|
{ |