protected function setUp() { $this->dataMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMap::class, array('getIsStatic', 'getRootLevel'), array('Vendor\\Ext\\Domain\\Model\\ClubMate', 'tx_ext_domain_model_clubmate')); $this->queryFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory::class, array('dummy')); $this->queryFactory->_set('configurationManager', $this->getMock(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::class)); $this->dataMapper = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::class, array('getDataMap', 'convertClassNameToTableName')); $this->dataMapper->expects($this->any())->method('getDataMap')->will($this->returnValue($this->dataMap)); $this->queryFactory->_set('dataMapper', $this->dataMapper); }
/** * Sets up this test case * * @return void */ protected function setUp() { $this->mockPersistenceManager = $this->getMock(\TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface::class); $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(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::class); $this->mockQuery = $this->getMock(\TYPO3\CMS\Extbase\Persistence\QueryInterface::class); $this->queryResult = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::class, array('dummy'), array($this->mockQuery)); $this->queryResult->_set('persistenceManager', $this->mockPersistenceManager); $this->queryResult->_set('dataMapper', $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)); }