| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 | 
							- <?php
 
- namespace Test\Unit;
 
- use RuntimeException;
 
- use InvalidArgumentException;
 
- use Test\TestCase;
 
- use phpseclib\Math\BigInteger as BigNumber;
 
- class NetApiTest extends TestCase
 
- {
 
-     /**
 
-      * net
 
-      * 
 
-      * @var Web3\Net
 
-      */
 
-     protected $net;
 
-     /**
 
-      * setUp
 
-      * 
 
-      * @return void
 
-      */
 
-     public function setUp()
 
-     {
 
-         parent::setUp();
 
-         $this->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();
 
-     }
 
- }
 
 
  |