Esempio n. 1
0
 /**
  * @dataProvider mockProvider
  * @param TX $obj
  */
 public function testCreate($obj, $mockApiContext)
 {
     $mockBlockCypherRestCall = $this->getMockBuilder('\\BlockCypher\\Transport\\BlockCypherRestCall')->disableOriginalConstructor()->getMock();
     $mockBlockCypherRestCall->expects($this->any())->method('execute')->will($this->returnValue(TXSkeletonTest::getJson()));
     $result = $obj->create($mockApiContext, $mockBlockCypherRestCall);
     $this->assertNotNull($result);
     $this->assertInstanceOf('\\BlockCypher\\Api\\TXSkeleton', $result);
 }
Esempio n. 2
0
 public function testSign()
 {
     $obj = static::getObject();
     $mockApiContext = $this->getMockBuilder('\\BlockCypher\\Rest\\ApiContext')->disableOriginalConstructor()->setMethods(array('getBaseChainUrl', 'getCoinSymbol'))->getMock();
     $mockApiContext->expects($this->any())->method('getBaseChainUrl')->will($this->returnValue("/v1/btc/test"));
     $mockApiContext->expects($this->once())->method('getCoinSymbol')->will($this->returnValue("btc-testnet"));
     $mockBlockCypherRestCall = $this->getMockBuilder('\\BlockCypher\\Transport\\BlockCypherRestCall')->disableOriginalConstructor()->getMock();
     $mockBlockCypherRestCall->expects($this->any())->method('execute')->will($this->returnValue(TXSkeletonTest::getJson()));
     $hexPrivateKey = "1551558c3b75f46b71ec068f9e341bf35ee6df361f7b805deb487d8a4d5f055e";
     $expectedPubkeys = array("0274cb62e999bdf96c9b4ef8a2b44c1ac54d9de879e2ee666fdbbf0e1a03090cdf");
     $expectedSignatures = array("30450221008627dbea1b070e8ceb025ab0ecb154227a65a34e6e8cd64966f181ca151d354f022066264b1930ad9e638f2853db683f5f81059e8c547bf9b4512046d2525c170c0b");
     /** @noinspection PhpParamsInspection */
     $result = $obj->sign(TXSkeletonTest::getObject(), $hexPrivateKey, $mockApiContext, $mockBlockCypherRestCall);
     $this->assertNotNull($result);
     $this->assertEquals($expectedSignatures, $result->getSignatures());
     $this->assertEquals($expectedPubkeys, $result->getPubkeys());
 }