| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace Test\Unit;
- use RuntimeException;
- use Test\TestCase;
- use Web3\Providers\HttpProvider;
- use Web3\Personal;
- class PersonalTest extends TestCase
- {
- /**
- * personal
- *
- * @var Web3\Personal
- */
- protected $personal;
- /**
- * setUp
- *
- * @return void
- */
- public function setUp(): void
- {
- parent::setUp();
- $this->personal = $this->web3->personal;
- }
- /**
- * testInstance
- *
- * @return void
- */
- public function testInstance()
- {
- $personal = new Personal($this->testHost);
- $this->assertTrue($personal->provider instanceof HttpProvider);
- }
- /**
- * testSetProvider
- *
- * @return void
- */
- public function testSetProvider()
- {
- $personal = $this->personal;
- $personal->provider = new HttpProvider('http://localhost:8545');
- $this->assertEquals($personal->provider->host, 'http://localhost:8545');
- $personal->provider = null;
- $this->assertEquals($personal->provider->host, 'http://localhost:8545');
- }
- /**
- * testCallThrowRuntimeException
- *
- * @return void
- */
- public function testCallThrowRuntimeException()
- {
- $this->expectException(RuntimeException::class);
- $personal = new Personal(null);
- $personal->newAccount('');
- }
- }
|