net = $this->web3->net; } /** * testVersion * * @return void */ public function testVersion() { $net = $this->net; $net->version(function ($err, $version) { if ($err !== null) { return $this->fail($err->getMessage()); } $this->assertTrue(is_string($version)); }); } /** * testPeerCount * * @return void */ public function testPeerCount() { $net = $this->net; $net->peerCount(function ($err, $count) { if ($err !== null) { return $this->fail($err->getMessage()); } $this->assertTrue($count instanceof BigNumber); }); } /** * testListening * * @return void */ public function testListening() { $net = $this->net; $net->listening(function ($err, $net) { if ($err !== null) { return $this->fail($err->getMessage()); } $this->assertTrue(is_bool($net)); }); } /** * testUnallowedMethod * * @return void */ public function testUnallowedMethod() { $this->expectException(RuntimeException::class); $net = $this->net; $net->hello(function ($err, $hello) { if ($err !== null) { return $this->fail($err->getMessage()); } $this->assertTrue(true); }); } /** * testWrongCallback * * @return void */ public function testWrongCallback() { $this->expectException(InvalidArgumentException::class); $net = $this->net; $net->version(); } }