From f3833e45b688c25f2b224464ce4ffe8320191a4f Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Wed, 13 Dec 2017 16:28:59 +0800 Subject: [PATCH] eth_blockNumber. --- src/Eth.php | 1 + test/unit/EthTest.php | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/Eth.php b/src/Eth.php index bf7084e..44e237b 100644 --- a/src/Eth.php +++ b/src/Eth.php @@ -29,6 +29,7 @@ class Eth 'eth_hashrate' => [], 'eth_gasPrice' => [], 'eth_accounts' => [], + 'eth_blockNumber' => [], ]; /** diff --git a/test/unit/EthTest.php b/test/unit/EthTest.php index b4aab92..c221b41 100644 --- a/test/unit/EthTest.php +++ b/test/unit/EthTest.php @@ -178,6 +178,27 @@ class EthTest extends TestCase }); } + /** + * testBlockNumber + * + * @return void + */ + public function testBlockNumber() + { + $eth = $this->web3->eth; + + $eth->blockNumber(function ($err, $blockNumber) { + if ($err !== null) { + return $this->fail($err->getMessage()); + } + if (isset($blockNumber->result)) { + $this->assertTrue(is_string($blockNumber->result)); + } else { + $this->fail($blockNumber->error->message); + } + }); + } + /** * testUnallowedMethod *