/** * Fund an address with faucet. * The faucet endpoint is only available on BlockCypher’s Test Blockchain and Bitcoin Testnet3 * * @param Faucet $faucet * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param BlockCypherRestCall $restCall is the Rest Call Service that is used to make rest calls * @return FaucetResponse */ public function turnOn(Faucet $faucet, $apiContext = null, $restCall = null) { $payLoad = $faucet->toJSON(); $chainUrlPrefix = $this->getChainUrlPrefix($apiContext); $json = $this->executeCall("{$chainUrlPrefix}/faucet", "POST", $payLoad, null, $apiContext, $restCall); $ret = new FaucetResponse(); $ret->fromJson($json); return $ret; }
/** * @dataProvider mockProvider * @param Faucet $obj */ public function testFundAddress($obj, $mockApiContext) { $mockBlockCypherRestCall = $this->getMockBuilder('\\BlockCypher\\Transport\\BlockCypherRestCall')->disableOriginalConstructor()->getMock(); $mockBlockCypherRestCall->expects($this->any())->method('execute')->will($this->returnValue(FaucetResponseTest::getJson())); $faucetResponse = FaucetResponseTest::getObject(); /** @noinspection PhpParamsInspection */ $result = $obj->fundAddress('CFqoZmZ3ePwK5wnkhxJjJAQKJ82C7RJdmd', 100000, $mockApiContext, $mockBlockCypherRestCall); $this->assertNotNull($result); $this->assertEquals($faucetResponse, $result); }