Пример #1
0
 /**
  * @return Block[]
  */
 public function testGetMultiple()
 {
     $request = $this->operation['response']['body'];
     $blockArray = Block::getList($request);
     $blockList = array();
     /** @var Block $block */
     foreach ($blockArray as $block) {
         $blockList[] = $block->getHash();
     }
     $result = Block::getMultiple($blockList, array(), $this->apiContext, $this->mockBlockCypherRestCall);
     $this->assertNotNull($result);
     $this->assertContainsOnlyInstancesOf('\\BlockCypher\\Api\\Block', $result);
     $this->assertEquals(count($result), count($blockList));
     foreach ($result as $resultBlock) {
         $this->assertContains($resultBlock->getHash(), $blockList);
     }
     return $result;
 }
Пример #2
0
 /**
  * @dataProvider mockProvider
  * @param Block $obj
  */
 public function testGetMultipleWithParams($obj, $mockApiContext)
 {
     $mockBlockCypherRestCall = $this->getMockBuilder('\\BlockCypher\\Transport\\BlockCypherRestCall')->disableOriginalConstructor()->getMock();
     $mockBlockCypherRestCall->expects($this->any())->method('execute')->will($this->returnValue('[' . BlockTest::getJson() . ']'));
     $blockList = array(BlockTest::getObject()->getHeight());
     $params = array('txstart' => 1, 'limit' => 1);
     $result = $obj->getMultiple($blockList, $params, $mockApiContext, $mockBlockCypherRestCall);
     $this->assertNotNull($result);
     $this->assertEquals($result[0], BlockTest::getObject());
 }