Example #1
0
 /**
  * @depends testSerializationDeserialization
  * @param Address $obj
  */
 public function testGetters($obj)
 {
     $this->assertEquals($obj->getAddress(), "1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD");
     $this->assertEquals($obj->getTotalReceived(), 4433416);
     $this->assertEquals($obj->getTotalSent(), 0);
     $this->assertEquals($obj->getBalance(), 4433416);
     $this->assertEquals($obj->getUnconfirmedBalance(), 0);
     $this->assertEquals($obj->getFinalBalance(), 4433416);
     $this->assertEquals($obj->getNTx(), 7);
     $this->assertEquals($obj->getUnconfirmedNTx(), 0);
     $this->assertEquals($obj->getFinalNTx(), 7);
     $this->assertEquals($obj->getTxrefs(), array(TXRefTest::getObject()));
     $this->assertEquals($obj->getUnconfirmedTxrefs(), array(TXRefTest::getObject()));
     $this->assertEquals($obj->getTxUrl(), "https://api.blockcypher.com/v1/btc/main/txs/");
     // Calculate properties
     $this->assertEquals($obj->getAllTxrefs(), array(TXRefTest::getObject(), TXRefTest::getObject()));
 }
 /**
  * @return Address
  */
 public function testGetWithUnspentOnly()
 {
     $request = $this->operation['response']['body'];
     $address = new Address($request);
     $params = array('unspentOnly' => 'true');
     $result = Address::get($address->getAddress(), $params, $this->apiContext, $this->mockBlockCypherRestCall);
     $this->assertNotNull($result);
     $this->assertInstanceOf('\\BlockCypher\\Api\\Address', $result);
     // Assert only immutable values.
     $this->assertEquals($address->getAddress(), $result->getAddress());
     $this->assertEquals($address->getTxUrl(), $result->getTxUrl());
     $this->assertEquals(count($address->getTxrefs()), count($result->getTxrefs()));
     $this->assertContainsOnlyInstancesOf('\\BlockCypher\\Api\\Txref', $result->getTxrefs());
     return $result;
 }