Merge branch 'fix-62'

This commit is contained in:
sc0Vu 2018-04-25 10:09:04 +08:00
commit 233379966b
4 changed files with 19 additions and 3 deletions

View File

@ -13,7 +13,7 @@
"guzzlehttp/guzzle": "~6.0", "guzzlehttp/guzzle": "~6.0",
"PHP": "^7.1", "PHP": "^7.1",
"kornrunner/keccak": "~1.0", "kornrunner/keccak": "~1.0",
"phpseclib/phpseclib": "~2.0" "phpseclib/phpseclib": "~2.0.11"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~6.0" "phpunit/phpunit": "~6.0"

View File

@ -17,7 +17,7 @@ class HttpProviderTest extends TestCase
*/ */
public function testSend() public function testSend()
{ {
$requestManager = new HttpRequestManager('http://localhost:8545'); $requestManager = new HttpRequestManager($this->testHost);
$provider = new HttpProvider($requestManager); $provider = new HttpProvider($requestManager);
$method = new ClientVersion('web3_clientVersion', []); $method = new ClientVersion('web3_clientVersion', []);
@ -36,7 +36,7 @@ class HttpProviderTest extends TestCase
*/ */
public function testBatch() public function testBatch()
{ {
$requestManager = new HttpRequestManager('http://localhost:8545'); $requestManager = new HttpRequestManager($this->testHost);
$provider = new HttpProvider($requestManager); $provider = new HttpProvider($requestManager);
$method = new ClientVersion('web3_clientVersion', []); $method = new ClientVersion('web3_clientVersion', []);
$callback = function ($err, $data) { $callback = function ($err, $data) {

View File

@ -45,5 +45,11 @@ class IntegerFormatterTest extends TestCase
$hex = $formatter->format('1', 20); $hex = $formatter->format('1', 20);
$this->assertEquals($hex, implode('', array_fill(0, 19, '0')) . '1'); $this->assertEquals($hex, implode('', array_fill(0, 19, '0')) . '1');
$hex = $formatter->format(48);
$this->assertEquals($hex, implode('', array_fill(0, 62, '0')) . '30');
$hex = $formatter->format('48');
$this->assertEquals($hex, implode('', array_fill(0, 62, '0')) . '30');
} }
} }

View File

@ -87,6 +87,16 @@ class UtilsTest extends TestCase
$this->assertEquals('0x', Utils::toHex(0, true)); $this->assertEquals('0x', Utils::toHex(0, true));
$this->assertEquals('0x', Utils::toHex(new BigNumber(0), true)); $this->assertEquals('0x', Utils::toHex(new BigNumber(0), true));
$this->assertEquals('0x30', Utils::toHex(48, true));
$this->assertEquals('0x30', Utils::toHex('48', true));
$this->assertEquals('30', Utils::toHex(48));
$this->assertEquals('30', Utils::toHex('48'));
$this->assertEquals('0x30', Utils::toHex(new BigNumber(48), true));
$this->assertEquals('0x30', Utils::toHex(new BigNumber('48'), true));
$this->assertEquals('30', Utils::toHex(new BigNumber(48)));
$this->assertEquals('30', Utils::toHex(new BigNumber('48')));
$this->expectException(InvalidArgumentException::class); $this->expectException(InvalidArgumentException::class);
$hex = Utils::toHex(new stdClass); $hex = Utils::toHex(new stdClass);
} }