Add Eth tests.
This commit is contained in:
parent
86b70f26c6
commit
49e19415b3
@ -3,6 +3,7 @@
|
|||||||
namespace Test\Unit;
|
namespace Test\Unit;
|
||||||
|
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
use InvalidArgumentException;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
use phpseclib\Math\BigInteger as BigNumber;
|
use phpseclib\Math\BigInteger as BigNumber;
|
||||||
|
|
||||||
@ -825,4 +826,18 @@ class EthApiTest extends TestCase
|
|||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testWrongCallback
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testWrongCallback()
|
||||||
|
{
|
||||||
|
$this->expectException(InvalidArgumentException::class);
|
||||||
|
|
||||||
|
$eth = $this->eth;
|
||||||
|
|
||||||
|
$eth->protocolVersion();
|
||||||
|
}
|
||||||
}
|
}
|
@ -7,6 +7,7 @@ use Test\TestCase;
|
|||||||
use Web3\Providers\HttpProvider;
|
use Web3\Providers\HttpProvider;
|
||||||
use Web3\RequestManagers\RequestManager;
|
use Web3\RequestManagers\RequestManager;
|
||||||
use Web3\RequestManagers\HttpRequestManager;
|
use Web3\RequestManagers\HttpRequestManager;
|
||||||
|
use Web3\Eth;
|
||||||
|
|
||||||
class EthTest extends TestCase
|
class EthTest extends TestCase
|
||||||
{
|
{
|
||||||
@ -36,7 +37,7 @@ class EthTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testInstance()
|
public function testInstance()
|
||||||
{
|
{
|
||||||
$eth = $this->eth;
|
$eth = new Eth($this->testHost);
|
||||||
|
|
||||||
$this->assertTrue($eth->provider instanceof HttpProvider);
|
$this->assertTrue($eth->provider instanceof HttpProvider);
|
||||||
$this->assertTrue($eth->provider->requestManager instanceof RequestManager);
|
$this->assertTrue($eth->provider->requestManager instanceof RequestManager);
|
||||||
@ -54,5 +55,22 @@ class EthTest extends TestCase
|
|||||||
$eth->provider = new HttpProvider($requestManager);
|
$eth->provider = new HttpProvider($requestManager);
|
||||||
|
|
||||||
$this->assertEquals($eth->provider->requestManager->host, 'http://localhost:8545');
|
$this->assertEquals($eth->provider->requestManager->host, 'http://localhost:8545');
|
||||||
|
|
||||||
|
$eth->provider = null;
|
||||||
|
|
||||||
|
$this->assertEquals($eth->provider->requestManager->host, 'http://localhost:8545');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testCallThrowRuntimeException
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testCallThrowRuntimeException()
|
||||||
|
{
|
||||||
|
$this->expectException(RuntimeException::class);
|
||||||
|
|
||||||
|
$eth = new Eth(null);
|
||||||
|
$eth->protocolVersion();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user