/** * @dataProvider mockProvider * @param TXClient $obj * @param PHPUnit_Framework_MockObject_MockObject|ApiContext $mockApiContext * @param PHPUnit_Framework_MockObject_MockObject|BlockCypherRestCall $mockBlockCypherRestCall */ public function testGetUnconfirmed($obj, $mockApiContext, $mockBlockCypherRestCall) { $mockBlockCypherRestCall->expects($this->any())->method('execute')->will($this->returnValue('[' . TXTest::getJson() . ']')); $result = $obj->getUnconfirmed(array(), $mockApiContext, $mockBlockCypherRestCall); $this->assertNotNull($result); $this->assertEquals($result[0], TXTest::getObject()); }
<?php // Run on console: // php -f .\sample\transaction-api\UnconfirmedTransactionsEndpoint.php require __DIR__ . '/../bootstrap.php'; use BlockCypher\Auth\SimpleTokenCredential; use BlockCypher\Client\TXClient; 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')); $txClient = new TXClient($apiContext); $txs = $txClient->getUnconfirmed(array(), $apiContext); ResultPrinter::printResult("Get Unconfirmed Transactions", "TX[]", null, null, $txs);