/** * @dataProvider mockProvider * @param NullDataClient $obj * @param PHPUnit_Framework_MockObject_MockObject|ApiContext $mockApiContext * @param PHPUnit_Framework_MockObject_MockObject|BlockCypherRestCall $mockBlockCypherRestCall */ public function testEmbedHex($obj, $mockApiContext, $mockBlockCypherRestCall) { $mockBlockCypherRestCall->expects($this->any())->method('execute')->will($this->returnValue(NullDataTest::getJsonWithHexData())); $result = $obj->embedHex(NullDataTest::getObjectWithHexData()->getData(), array(), $mockApiContext, $mockBlockCypherRestCall); $this->assertNotNull($result); }
<?php // Run on console: // php -f .\sample\transaction-api\DataEndpoint.php require __DIR__ . '/../bootstrap.php'; use BlockCypher\Auth\SimpleTokenCredential; use BlockCypher\Client\NullDataClient; use BlockCypher\Rest\ApiContext; $apiContext = ApiContext::create('main', 'btc', 'v1', new SimpleTokenCredential('c0afcccdde5081d6429de37d16166ead'), array('mode' => 'sandbox', 'log.LogEnabled' => true, 'log.FileName' => 'BlockCypher.log', 'log.LogLevel' => 'DEBUG')); $nullDataClient = new NullDataClient($apiContext); $nullData = $nullDataClient->embedString('***BlockCypher Data Endpoint Test***'); // max 40 bytes ResultPrinter::printResult("Embed Data On Blockchain", "NullData", $nullData->getHash(), null, $nullData);