/** * @dataProvider mockProviderGetParamsValidation * @param Address $obj * @param $mockApiContext * @param $params * @expectedException \InvalidArgumentException */ public function testGetMultipleParamsValidationForParams($obj, $mockApiContext, $params) { $mockBlockCypherRestCall = $this->getMockBuilder('\\BlockCypher\\Transport\\BlockCypherRestCall')->disableOriginalConstructor()->getMock(); $mockBlockCypherRestCall->expects($this->any())->method('execute')->will($this->returnValue('[' . AddressTest::getJson() . ']')); $addressList = array(AddressTest::getObject()->getAddress()); /** @noinspection PhpUndefinedVariableInspection */ /** @noinspection PhpParamsInspection */ $obj->get($addressList, $params, $mockApiContext, $mockBlockCypherRestCall); }
/** * @dataProvider mockProvider * @param Address $obj */ public function testGet($obj, $mockApiContext) { $mockBlockCypherRestCall = $this->getMockBuilder('\\BlockCypher\\Transport\\BlockCypherRestCall')->disableOriginalConstructor()->getMock(); $mockBlockCypherRestCall->expects($this->any())->method('execute')->will($this->returnValue(WalletAsAddressTest::getJson())); /** @noinspection PhpParamsInspection */ $result = $obj->get("alice", array(), $mockApiContext, $mockBlockCypherRestCall); $this->assertNotNull($result); $this->assertInstanceOf('BlockCypher\\Api\\Address', $result); }
/** * @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; }