From d1c5ae15d019b980c54aa453a5c1eca513992e10 Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Mon, 18 Dec 2017 11:57:03 +0800 Subject: [PATCH] eth batch --- src/Eth.php | 13 +++++++++++++ test/unit/EthTest.php | 22 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/Eth.php b/src/Eth.php index 23bbb7a..9564032 100644 --- a/src/Eth.php +++ b/src/Eth.php @@ -483,4 +483,17 @@ class Eth } return false; } + + /** + * batch + * + * @param bool $status + * @return void + */ + public function batch($status) + { + $status = is_bool($status); + + $this->provider->batch($status); + } } \ No newline at end of file diff --git a/test/unit/EthTest.php b/test/unit/EthTest.php index 984535e..5963784 100644 --- a/test/unit/EthTest.php +++ b/test/unit/EthTest.php @@ -1108,6 +1108,28 @@ class EthTest extends TestCase }); } + /** + * testBatch + * + * @return void + */ + public function testBatch() + { + $eth = $this->eth; + + $eth->batch(true); + $eth->protocolVersion(); + $eth->syncing(); + + $eth->provider->execute(function ($err, $data) { + if ($err !== null) { + return $this->fail($err->getMessage()); + } + $this->assertTrue(is_string($data[0]->result)); + $this->assertTrue($data[1]->result !== null); + }); + } + /** * testUnallowedMethod *