コード例 #1
0
 /**
  * Sets up this test case
  *
  * @return void
  */
 public function setUp()
 {
     $this->mockPersistenceManager = $this->getMock('Tx_Extbase_Persistence_ManagerInterface');
     $this->mockPersistenceManager->expects($this->any())->method('getObjectDataByQuery')->will($this->returnValue(array('one', 'two')));
     $this->mockPersistenceManager->expects($this->any())->method('getObjectCountByQuery')->will($this->returnValue(2));
     $this->mockDataMapper = $this->getMock('Tx_Extbase_Persistence_Mapper_DataMapper');
     $this->mockQuery = $this->getMock('Tx_Extbase_Persistence_QueryInterface');
     $this->queryResult = new Tx_Extbase_Persistence_QueryResult($this->mockQuery);
     $this->queryResult->injectPersistenceManager($this->mockPersistenceManager);
     $this->queryResult->injectDataMapper($this->mockDataMapper);
     $this->sampleResult = array(array('foo' => 'Foo1', 'bar' => 'Bar1'), array('foo' => 'Foo2', 'bar' => 'Bar2'));
     $this->mockDataMapper->expects($this->any())->method('map')->will($this->returnValue($this->sampleResult));
 }