From d52a8ddfa0e5f875728f333ff55c094b7f209487 Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Sun, 21 Jan 2018 16:20:53 +0800 Subject: [PATCH] Add test for unlockAccount with duration. --- test/unit/PersonalApiTest.php | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/test/unit/PersonalApiTest.php b/test/unit/PersonalApiTest.php index 9924b0a..a082f8b 100644 --- a/test/unit/PersonalApiTest.php +++ b/test/unit/PersonalApiTest.php @@ -88,8 +88,33 @@ class PersonalApiTest extends TestCase $personal->unlockAccount($this->newAccount, '123456', function ($err, $unlocked) { if ($err !== null) { - // infura banned us to use unlock account - return $this->assertTrue($err->getCode() === 405); + return $this->fail($err->getMessage()); + } + $this->assertTrue($unlocked); + }); + } + + /** + * testUnlockAccountWithDuration + * + * @return void + */ + public function testUnlockAccountWithDuration() + { + $personal = $this->personal; + + // create account + $personal->newAccount('123456', function ($err, $account) { + if ($err !== null) { + return $this->fail($e->getMessage()); + } + $this->newAccount = $account; + $this->assertTrue(is_string($account)); + }); + + $personal->unlockAccount($this->newAccount, '123456', 100, function ($err, $unlocked) { + if ($err !== null) { + return $this->fail($err->getMessage()); } $this->assertTrue($unlocked); });