Exemple #1
0
 /**
  * @depends testSerializationDeserialization
  * @param TX $obj
  */
 public function testGetters($obj)
 {
     /** @noinspection SpellCheckingInspection */
     $addresses = array("13XXaBufpMvqRqLkyDty1AXqueZHVe6iyy", "19YtzZdcfs1V2ZCgyRWo8i2wLT8ND1Tu4L", "1BNiazBzCxJacAKo2yL83Wq1VJ18AYzNHy", "1GbMfYui17L5m6sAy3L3WXAtf1P32bxJXq", "1N2f642sbgCMbNtXFajz9XDACDFnFzdXzV");
     /** @noinspection SpellCheckingInspection */
     $this->assertEquals($obj->getBlockHash(), "0000000000000000c504bdea36e531d8089d324f2d936c86e3274f97f8a44328");
     $this->assertEquals($obj->getBlockHeight(), "293000");
     /** @noinspection SpellCheckingInspection */
     $this->assertEquals($obj->getHash(), "f854aebae95150b379cc1187d848d58225f3c4157fe992bcd166f58bd5063449");
     $this->assertEquals($obj->getAddresses(), $addresses);
     $this->assertEquals($obj->getTotal(), 70320221545);
     $this->assertEquals($obj->getFees(), 0);
     $this->assertEquals($obj->getHex(), "010000000421f1708a507a4eb9df24eb1a8c0cb26298b5895ac2e5222e80ab90bfb7103958010000006b4830450220504b1ccfddf508422bdd8b0fcda2b1483e87aee1b486c0130bc29226bbce3b4e022100b5befcfcf0d3bf6ebf0ac2f93badb19e3042c7bed456c398e743b885e782466c012103b1feb40b99e8ff18469484a50e8b52cc478d5f4f773a341fbd920a4ceaedd4bfffffffffd9001d6c668de38a5e57eb3d1b4a0b3c793cb13f221bd17fb90ebad3b36b96f6240000006b48304502210086de855e03008abcc49335c775973eab9ace2e16c3bfe6536218c1d029287fdb0220129ced657870af63f61cdd4b941996f9a243d1f306e774fc9c5f3dea0af8d581012103cbe40d1d790799a6494c07f844eaf05b4c6deab0b9dee2ee45c8decead12c5cdffffffff88820c9edafa1938e32208169fa5778a67b4af66b9d8b09f3094665e69f9a29e010000006b48304502201f1eb5b79279258a91c00dee09dff5d6f6ece7c01639e66a6bdd579136ecddee022100d4a9ed93183bf338e51ba80bc1dd10ff03e9e159bd8ea59db3a5c10aa0ccd3400121022667ee37e180c1ad2fef6f16aa52ed27799f629364dfe51e144dd683317dbbd2ffffffff5d2d7404132ec7fe164b053360ee4619ec04fbe4f0e65fa8905360b8bacb9c27000000006b483045022100baac0c25867855f62592872cfac522d59fddd590a6cc290c8ad3bbe6b1151b5802204f2713c565ce6b00e5ea00e955d35e3b0878af5474feda35ebbb73232122d5480121023ed3b44ad598e3834e561efed205c221b7bc2e577e752eeaa66e85e60d0381c9ffffffff01696d695f100000001976a914e6aad9d712c419ea8febf009a3f3bfdd8d222fac88ac00000000");
     $this->assertEquals($obj->getPreference(), "low");
     $this->assertEquals($obj->getRelayedBy(), "");
     $this->assertEquals($obj->getConfirmed(), "2014-03-29T01:29:19Z");
     $this->assertEquals($obj->getReceived(), "2014-03-29T01:29:19Z");
     $this->assertEquals($obj->getVer(), 1);
     $this->assertEquals($obj->getLockTime(), 0);
     $this->assertEquals($obj->getDoubleSpend(), false);
     $this->assertEquals($obj->getDoubleOf(), "f854aebae95150b379cc1187d848d58225f3c4157fe992bcd166f58bd5063449");
     // Only if double_spend = true
     $this->assertEquals($obj->getReceiveCount(), 732);
     // Unconfirmed transactions only.
     $this->assertEquals($obj->getVinSz(), 4);
     $this->assertEquals($obj->getVoutSz(), 1);
     $this->assertEquals($obj->getConfirmations(), 59116);
     $this->assertEquals($obj->getConfidence(), 1);
     $this->assertEquals($obj->getGuaranteed(), true);
     $this->assertEquals($obj->getInputs(), array(TXInputTest::getObject()));
     $this->assertEquals($obj->getOutputs(), array(TXOutputTest::getObject()));
     $this->assertEquals($obj->getNextInputs(), "https://api.blockcypher.com/v1/btc/main/txs/f854aebae95150b379cc1187d848d58225f3c4157fe992bcd166f58bd5063449?instart=2&outstart=1&limit=1");
     $this->assertEquals($obj->getNextOutputs(), "https://api.blockcypher.com/v1/btc/main/txs/f854aebae95150b379cc1187d848d58225f3c4157fe992bcd166f58bd5063449?instart=2&outstart=1&limit=1");
 }
 /**
  * @return TX
  */
 public function testGetWithPaging()
 {
     $request = $this->operation['response']['body'];
     $transaction = new TX($request);
     $params = array('instart' => 1, 'outstart' => 1, 'limit' => 1);
     $result = TX::get($transaction->getHash(), $params, $this->apiContext, $this->mockBlockCypherRestCall);
     $this->assertNotNull($result);
     $this->assertInstanceOf('\\BlockCypher\\Api\\TX', $result);
     // Assert only immutable values.
     $this->assertEquals($transaction->getHash(), $result->getHash());
     $this->assertEquals($transaction->getAddresses(), $result->getAddresses());
     $transactionInputs = $transaction->getInputs();
     $resultInputs = $result->getInputs();
     $this->assertEquals($transactionInputs[0]->getPrevHash(), $resultInputs[0]->getPrevHash());
     return $result;
 }