web3 = $web3; } /** * testInstance * * @return void */ public function testInstance() { $web3 = $this->web3; $this->assertTrue($web3->provider instanceof HttpProvider); $this->assertTrue($web3->provider->requestManager instanceof RequestManager); $this->assertTrue($web3->eth instanceof Eth); } /** * testSend * * @return void */ public function testSend() { $web3 = $this->web3; $web3->clientVersion(function ($err, $version) { if ($err !== null) { return $this->markTestIncomplete($err->getMessage()); } $this->assertTrue(is_string($version->result)); }); $web3->sha3($this->testHex, function ($err, $hash) { if ($err !== null) { return $this->markTestIncomplete($err->getMessage()); } $this->assertEquals($hash->result, $this->testHash); }); } /** * testBatch * * @return void */ public function testBatch() { $web3 = $this->web3; $web3->batch(true); $web3->clientVersion(); $web3->sha3($this->testHex); $web3->provider->execute(function ($err, $data) { if ($err !== null) { return $this->markTestIncomplete($err->getMessage()); } $this->assertTrue(is_string($data[0]->result)); $this->assertEquals($data[1]->result, $this->testHash); }); } }