Beispiel #1
0
 /**
  * Obtain multiple TransactionConfidences resources for the given identifiers.
  *
  * @deprecated since version 1.2.1 Use TXClient.
  * @param string[] $array
  * @param array $params Parameters
  * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
  * @param BlockCypherRestCall $restCall is the Rest Call Service that is used to make rest calls
  * @return TXConfidence[]
  */
 public static function getMultiple($array, $params = array(), $apiContext = null, $restCall = null)
 {
     ArgumentArrayValidator::validate($array, 'array');
     ArgumentGetParamsValidator::validate($params, 'params');
     $allowedParams = array();
     $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams);
     $payLoad = "";
     $txhashList = implode(";", $array);
     $chainUrlPrefix = self::getChainUrlPrefix($apiContext);
     $json = self::executeCall("{$chainUrlPrefix}/txs/{$txhashList}/confidence" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall);
     return TXConfidence::getList($json);
 }
 /**
  * @return TXConfidence[]
  */
 public function testGetMultiple()
 {
     $request = $this->operation['response']['body'];
     $txConfidenceArray = TXConfidence::getList($request);
     $txConfidenceList = array();
     /** @var TXConfidence $txConfidence */
     foreach ($txConfidenceArray as $txConfidence) {
         $txConfidenceList[] = $txConfidence->getTxhash();
     }
     $result = TXConfidence::getMultiple($txConfidenceList, array(), $this->apiContext, $this->mockBlockCypherRestCall);
     $this->assertNotNull($result);
     $this->assertContainsOnlyInstancesOf('\\BlockCypher\\Api\\TXConfidence', $result);
     $this->assertEquals(count($result), count($txConfidenceList));
     foreach ($result as $resultTxConfidence) {
         $this->assertContains($resultTxConfidence->getTxhash(), $txConfidenceList);
     }
     return $result;
 }
 /**
  * @dataProvider mockProviderGetParamsValidation
  * @param TXConfidence $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('[' . TXConfidenceTest::getJson() . ']'));
     $txConfidenceList = array(TXConfidenceTest::getObject()->getTxhash());
     /** @noinspection PhpUndefinedVariableInspection */
     /** @noinspection PhpParamsInspection */
     $obj->getMultiple($txConfidenceList, $params, $mockApiContext, $mockBlockCypherRestCall);
 }