Exemplo n.º 1
0
 /**
  * @dataProvider mockProvider
  * @param MicroTXClient $obj
  * @param PHPUnit_Framework_MockObject_MockObject|ApiContext $mockApiContext
  * @param PHPUnit_Framework_MockObject_MockObject|BlockCypherRestCall $mockBlockCypherRestCall
  */
 public function testFromWif($obj, $mockApiContext, $mockBlockCypherRestCall)
 {
     $mockBlockCypherRestCall->expects($this->any())->method('execute')->will($this->returnValue(MicroTXTest::getJson()));
     /** @noinspection SpellCheckingInspection */
     $result = $obj->sendWithWif("BpouCdZ5dXbjcUDQBj8ZVYBbSPtWYDQHxuDcP48VA6Q7dZuqW4UJ", "C4MYFr4EAdqEeUKxTnPUF3d3whWcPMz1Fi", 10000, $mockApiContext, $mockBlockCypherRestCall);
     $this->assertNotNull($result);
 }
<?php

// Run on console:
// php -f .\sample\microtransaction-api\CreateMicroTXFromPrivateDocsSample.php
require __DIR__ . '/../bootstrap.php';
use BlockCypher\Auth\SimpleTokenCredential;
use BlockCypher\Client\MicroTXClient;
use BlockCypher\Rest\ApiContext;
$apiContext = ApiContext::create('test', 'bcy', 'v1', new SimpleTokenCredential('c0afcccdde5081d6429de37d16166ead'), array('mode' => 'sandbox', 'log.LogEnabled' => true, 'log.FileName' => 'BlockCypher.log', 'log.LogLevel' => 'DEBUG'));
$microTXClient = new MicroTXClient($apiContext);
$microTX = $microTXClient->sendWithPrivateKey("2c2cc015519b79782bd9c5af66f442e808f573714e3c4dc6df7d79c183963cff", "C4MYFr4EAdqEeUKxTnPUF3d3whWcPMz1Fi", 10000);
ResultPrinter::printResult("Created and Send MicroTX", "MicroTX", $microTX->getHash(), null, $microTX);