Add Net tests.
This commit is contained in:
parent
aead0b3c75
commit
86b70f26c6
@ -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;
|
||||||
|
|
||||||
@ -96,4 +97,18 @@ class NetApiTest extends TestCase
|
|||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testWrongCallback
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testWrongCallback()
|
||||||
|
{
|
||||||
|
$this->expectException(InvalidArgumentException::class);
|
||||||
|
|
||||||
|
$net = $this->net;
|
||||||
|
|
||||||
|
$net->version();
|
||||||
|
}
|
||||||
}
|
}
|
@ -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\Net;
|
||||||
|
|
||||||
class NetTest extends TestCase
|
class NetTest extends TestCase
|
||||||
{
|
{
|
||||||
@ -36,7 +37,7 @@ class NetTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testInstance()
|
public function testInstance()
|
||||||
{
|
{
|
||||||
$net = $this->net;
|
$net = new Net($this->testHost);
|
||||||
|
|
||||||
$this->assertTrue($net->provider instanceof HttpProvider);
|
$this->assertTrue($net->provider instanceof HttpProvider);
|
||||||
$this->assertTrue($net->provider->requestManager instanceof RequestManager);
|
$this->assertTrue($net->provider->requestManager instanceof RequestManager);
|
||||||
@ -54,5 +55,22 @@ class NetTest extends TestCase
|
|||||||
$net->provider = new HttpProvider($requestManager);
|
$net->provider = new HttpProvider($requestManager);
|
||||||
|
|
||||||
$this->assertEquals($net->provider->requestManager->host, 'http://localhost:8545');
|
$this->assertEquals($net->provider->requestManager->host, 'http://localhost:8545');
|
||||||
|
|
||||||
|
$net->provider = null;
|
||||||
|
|
||||||
|
$this->assertEquals($net->provider->requestManager->host, 'http://localhost:8545');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testCallThrowRuntimeException
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testCallThrowRuntimeException()
|
||||||
|
{
|
||||||
|
$this->expectException(RuntimeException::class);
|
||||||
|
|
||||||
|
$net = new Net(null);
|
||||||
|
$net->version();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -70,7 +70,7 @@ class PersonalTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->expectException(RuntimeException::class);
|
$this->expectException(RuntimeException::class);
|
||||||
|
|
||||||
$personal = new personal(null);
|
$personal = new Personal(null);
|
||||||
$personal->newAccount('');
|
$personal->newAccount('');
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user