/** * @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; }
/** * @dataProvider mockProviderGetParamsValidation * @param TX $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('[' . TXTest::getJson() . ']')); $transactionList = array(AddressTest::getObject()->getAddress()); /** @noinspection PhpUndefinedVariableInspection */ /** @noinspection PhpParamsInspection */ $obj->get($transactionList, $params, $mockApiContext, $mockBlockCypherRestCall); }