diff --git a/src/JsonRpc/Client.php b/src/JsonRpc/Client.php index 514d322..4ec4e77 100644 --- a/src/JsonRpc/Client.php +++ b/src/JsonRpc/Client.php @@ -141,6 +141,18 @@ public function batchSend() } + public function id() + { + return $this->id; + } + + + public function multi() + { + return $this->multi; + } + + private function work($method, $params, $notify = false) { diff --git a/tests/ClientTests/ClientRequestTest.php b/tests/ClientTests/ClientRequestTest.php index 4477830..0b73734 100644 --- a/tests/ClientTests/ClientRequestTest.php +++ b/tests/ClientTests/ClientRequestTest.php @@ -14,11 +14,20 @@ public function testValidBatchUnordered() $params1 = array(42, 6); $params2 = array(42, 7); + + $this->assertFalse($this->client->multi()); $this->client->batchOpen(); + $this->assertEquals(0, $this->client->id()); + $this->assertTrue($this->client->multi()); + $this->client->call($method, $params1); + $this->assertEquals(1, $this->client->id()); $this->client->call($method, $params2); + $this->assertEquals(2, $this->client->id()); $this->client->call($method, $params1); + $this->assertEquals(3, $this->client->id()); $this->client->call($method, $params2); + $this->assertEquals(4, $this->client->id()); $json = '[ {"jsonrpc": "2.0", "result": 6, "id": 2},