12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace Test\Unit;
- use RuntimeException;
- use Test\TestCase;
- use Web3\Providers\HttpProvider;
- use Web3\RequestManagers\RequestManager;
- use Web3\RequestManagers\HttpRequestManager;
- use Web3\Net;
- class NetTest extends TestCase
- {
-
- protected $net;
-
- public function setUp()
- {
- parent::setUp();
- $this->net = $this->web3->net;
- }
-
- public function testInstance()
- {
- $net = new Net($this->testHost);
- $this->assertTrue($net->provider instanceof HttpProvider);
- $this->assertTrue($net->provider->requestManager instanceof RequestManager);
- }
-
- public function testSetProvider()
- {
- $net = $this->net;
- $requestManager = new HttpRequestManager('http://localhost:8545');
- $net->provider = new HttpProvider($requestManager);
- $this->assertEquals($net->provider->requestManager->host, 'http://localhost:8545');
- $net->provider = null;
- $this->assertEquals($net->provider->requestManager->host, 'http://localhost:8545');
- }
-
- public function testCallThrowRuntimeException()
- {
- $this->expectException(RuntimeException::class);
- $net = new Net(null);
- $net->version();
- }
- }
|