public function testFindDataRecords_001() { // $data_store = $this->getMock("KinesisShardFileDataStore", array('restore')); // $data_store->expects($this->any()) // ->method('restore') // ->will($this->returnValue(array())); $kinesis = $this->getMock("KinesisClient", array('getShardIterator', 'getRecords')); $kinesis->expects($this->any())->method('getShardIterator')->will($this->returnValue(array('ShardIterator' => '123456789'))); $kinesis->expects($this->any())->method('getRecords')->will($this->returnValue(array('NextShardIterator' => '234567891', 'Records' => array(array('SequenceNumber' => '11111', 'Data' => 'hoge', 'PartitionKey' => 'pt1'), array('SequenceNumber' => '11112', 'Data' => 'foo', 'PartitionKey' => 'pt1'))))); $proxy = $this->getMockBuilder('Rf\\Aws\\Kinesis\\ClientLibrary\\KinesisProxy')->setMethods(array('getKinesis'))->disableOriginalConstructor()->getMock(); $proxy->expects($this->any())->method('getKinesis')->will($this->returnValue($kinesis)); // $proxy->expects($this->any()) // ->method('getDataStore') // ->will($this->returnValue($data_store)); $shard = new KinesisShard(); $shard->setStreamName('dummy-stream-name'); $shard->setShardId('dummy-shardId-000000000001'); $shard->setSequenceNumber('234567891'); $result = $proxy->findDataRecords($shard, 1000, 1); $this->assertCount(2, $result); $result_data_record1 = $result[0]; $this->assertEquals('dummy-stream-name', $result_data_record1->getStreamName()); $this->assertEquals('dummy-shardId-000000000001', $result_data_record1->getShardId()); $this->assertEquals('11111', $result_data_record1->getSequenceNumber()); $this->assertEquals('hoge', $result_data_record1->getData()); $this->assertEquals('pt1', $result_data_record1->getPartitionKey()); $result_data_record2 = $result[1]; $this->assertEquals('11112', $result_data_record2->getSequenceNumber()); $this->assertEquals('foo', $result_data_record2->getData()); $this->assertEquals('pt1', $result_data_record2->getPartitionKey()); }