Add Personal tests.
This commit is contained in:
parent
82087c92ce
commit
aead0b3c75
@ -3,6 +3,7 @@
|
|||||||
namespace Test\Unit;
|
namespace Test\Unit;
|
||||||
|
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
use InvalidArgumentException;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
class PersonalApiTest extends TestCase
|
class PersonalApiTest extends TestCase
|
||||||
@ -200,4 +201,18 @@ class PersonalApiTest extends TestCase
|
|||||||
$this->assertTrue(is_string($account));
|
$this->assertTrue(is_string($account));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testWrongCallback
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testWrongCallback()
|
||||||
|
{
|
||||||
|
$this->expectException(InvalidArgumentException::class);
|
||||||
|
|
||||||
|
$personal = $this->personal;
|
||||||
|
|
||||||
|
$personal->newAccount('123456');
|
||||||
|
}
|
||||||
}
|
}
|
@ -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\Personal;
|
||||||
|
|
||||||
class PersonalTest extends TestCase
|
class PersonalTest extends TestCase
|
||||||
{
|
{
|
||||||
@ -36,7 +37,7 @@ class PersonalTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testInstance()
|
public function testInstance()
|
||||||
{
|
{
|
||||||
$personal = $this->personal;
|
$personal = new Personal($this->testHost);
|
||||||
|
|
||||||
$this->assertTrue($personal->provider instanceof HttpProvider);
|
$this->assertTrue($personal->provider instanceof HttpProvider);
|
||||||
$this->assertTrue($personal->provider->requestManager instanceof RequestManager);
|
$this->assertTrue($personal->provider->requestManager instanceof RequestManager);
|
||||||
@ -54,5 +55,22 @@ class PersonalTest extends TestCase
|
|||||||
$personal->provider = new HttpProvider($requestManager);
|
$personal->provider = new HttpProvider($requestManager);
|
||||||
|
|
||||||
$this->assertEquals($personal->provider->requestManager->host, 'http://localhost:8545');
|
$this->assertEquals($personal->provider->requestManager->host, 'http://localhost:8545');
|
||||||
|
|
||||||
|
$personal->provider = null;
|
||||||
|
|
||||||
|
$this->assertEquals($personal->provider->requestManager->host, 'http://localhost:8545');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testCallThrowRuntimeException
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testCallThrowRuntimeException()
|
||||||
|
{
|
||||||
|
$this->expectException(RuntimeException::class);
|
||||||
|
|
||||||
|
$personal = new personal(null);
|
||||||
|
$personal->newAccount('');
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user