/** * Sets up this test case * */ public function setUp() { $this->persistenceManager = $this->getMockBuilder(\TYPO3\Flow\Persistence\Generic\PersistenceManager::class)->disableOriginalConstructor()->getMock(); $this->persistenceManager->expects($this->any())->method('getObjectDataByQuery')->will($this->returnValue(array('one', 'two'))); $this->dataMapper = $this->createMock(\TYPO3\Flow\Persistence\Generic\DataMapper::class); $this->query = $this->createMock(\TYPO3\Flow\Persistence\QueryInterface::class); $this->queryResult = new QueryResult($this->query); $this->queryResult->injectPersistenceManager($this->persistenceManager); $this->queryResult->injectDataMapper($this->dataMapper); $this->sampleResult = array(array('foo' => 'Foo1', 'bar' => 'Bar1'), array('foo' => 'Foo2', 'bar' => 'Bar2')); $this->dataMapper->expects($this->any())->method('mapToObjects')->will($this->returnValue($this->sampleResult)); }
/** * Sets up this test case * */ public function setUp() { $this->persistenceManager = $this->getMock('TYPO3\\Flow\\Persistence\\Generic\\PersistenceManager', array(), array(), '', FALSE); $this->persistenceManager->expects($this->any())->method('getObjectDataByQuery')->will($this->returnValue(array('one', 'two'))); $this->dataMapper = $this->getMock('TYPO3\\Flow\\Persistence\\Generic\\DataMapper'); $this->query = $this->getMock('TYPO3\\Flow\\Persistence\\QueryInterface'); $this->queryResult = new QueryResult($this->query); $this->queryResult->injectPersistenceManager($this->persistenceManager); $this->queryResult->injectDataMapper($this->dataMapper); $this->sampleResult = array(array('foo' => 'Foo1', 'bar' => 'Bar1'), array('foo' => 'Foo2', 'bar' => 'Bar2')); $this->dataMapper->expects($this->any())->method('mapToObjects')->will($this->returnValue($this->sampleResult)); }