Пример #1
0
 /**
  * @depends testSerializationDeserialization
  * @param TXRef $obj
  */
 public function testGetters($obj)
 {
     $this->assertEquals($obj->getTxHash(), "14b1052855bbf6561bc4db8aa501762e7cc1e86994dda9e782a6b73b1ce0dc1e");
     $this->assertEquals($obj->getBlockHeight(), 302013);
     $this->assertEquals($obj->getTxInputN(), -1);
     $this->assertEquals($obj->getTxOutputN(), 0);
     $this->assertEquals($obj->getValue(), 20213);
     $this->assertEquals($obj->getRefBalance(), 35000);
     $this->assertEquals($obj->getPreference(), "high");
     $this->assertEquals($obj->isSpent(), false);
     $this->assertEquals($obj->getSpent(), false);
     $this->assertEquals($obj->getSpentBy(), "14b1052855bbf6561bc4db8aa501762e7cc1e86994dda9e782a6b73b1ce0dc1e");
     $this->assertEquals($obj->getConfirmations(), 50118);
     $this->assertEquals($obj->getConfirmed(), "2014-05-22T03:46:25Z");
     $this->assertEquals($obj->getReceived(), "2014-05-22T03:46:25Z");
     $this->assertEquals($obj->isDoubleSpend(), false);
     $this->assertEquals($obj->getDoubleSpend(), false);
     $this->assertEquals($obj->getDoubleOf(), "14b1052855bbf6561bc4db8aa501762e7cc1e86994dda9e782a6b73b1ce0dc1e");
     $this->assertEquals($obj->getReceiveCount(), 42);
     $this->assertEquals($obj->getConfidence(), 0.98819);
 }
 /**
  * @param BlockCypherTXRef $blockCypherTXRef
  * @return TransactionListItem
  * @throws \Exception
  */
 public static function from(BlockCypherTXRef $blockCypherTXRef)
 {
     $transactionListItem = new self();
     // DEBUG
     //var_dump($blockCypherTXRef);
     //die();
     $transactionListItem->setTxHash($blockCypherTXRef->getTxHash());
     $transactionListItem->setConfirmations($blockCypherTXRef->getConfirmations());
     if ($blockCypherTXRef->getReceived() !== null) {
         $transactionListItem->setReceived(DateTimeFactory::fromISO8601($blockCypherTXRef->getReceived()));
     }
     if ($blockCypherTXRef->getConfirmed() !== null) {
         $transactionListItem->setConfirmed(DateTimeFactory::fromISO8601($blockCypherTXRef->getConfirmed()));
     }
     $transactionListItem->setBlockHeight($blockCypherTXRef->getBlockHeight());
     return $transactionListItem;
 }