/** * @param bool $static * @param bool $rootLevel * @param bool $expectedResult * * @dataProvider getStaticAndRootLevelAndExpectedResult * @test */ public function createDoesNotRespectStoragePageIfStaticOrRootLevelIsTrue($static, $rootLevel, $expectedResult) { /** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */ $objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManager::class); $this->queryFactory->_set('objectManager', $objectManager); $this->dataMap->expects($this->any())->method('getIsStatic')->will($this->returnValue($static)); $this->dataMap->expects($this->any())->method('getRootLevel')->will($this->returnValue($rootLevel)); $query = $this->getMock(\TYPO3\CMS\Extbase\Persistence\QueryInterface::class); $objectManager->expects($this->at(0))->method('get')->with(\TYPO3\CMS\Extbase\Persistence\QueryInterface::class)->will($this->returnValue($query)); $querySettings = new \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings(); $objectManager->expects($this->at(1))->method('get')->with(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class)->will($this->returnValue($querySettings)); $query->expects($this->once())->method('setQuerySettings')->with($querySettings); $this->queryFactory->create($this->className); $this->assertSame($expectedResult, $querySettings->getRespectStoragePage()); }
/** * Sets the record type * * @param string $recordType The record type * @return void */ public function setRecordType($recordType) { parent::setRecordType($recordType); if ($this->getClassName() === 'In2\\Femanager\\Domain\\Model\\User' || $this->getClassName() === 'In2\\Femanager\\Domain\\Model\\UserGroup') { $this->recordType = NULL; } }
/** * @param DataMap $dataMap * @param string $tableName * @return DataMap */ protected function addMetaDataColumnNames(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMap $dataMap, $tableName) { $controlSection = $GLOBALS['TCA'][$tableName]['ctrl']; $dataMap->setPageIdColumnName('pid'); if (isset($controlSection['tstamp'])) { $dataMap->setModificationDateColumnName($controlSection['tstamp']); } if (isset($controlSection['crdate'])) { $dataMap->setCreationDateColumnName($controlSection['crdate']); } if (isset($controlSection['cruser_id'])) { $dataMap->setCreatorColumnName($controlSection['cruser_id']); } if (isset($controlSection['delete'])) { $dataMap->setDeletedFlagColumnName($controlSection['delete']); } if (isset($controlSection['languageField'])) { $dataMap->setLanguageIdColumnName($controlSection['languageField']); } if (isset($controlSection['transOrigPointerField'])) { $dataMap->setTranslationOriginColumnName($controlSection['transOrigPointerField']); } if (isset($controlSection['transOrigDiffSourceField'])) { $dataMap->setTranslationOriginDiffSourceName($controlSection['transOrigDiffSourceField']); } if (isset($controlSection['type'])) { $dataMap->setRecordTypeColumnName($controlSection['type']); } if (isset($controlSection['rootLevel'])) { $dataMap->setRootLevel($controlSection['rootLevel']); } if (isset($controlSection['is_static'])) { $dataMap->setIsStatic($controlSection['is_static']); } if (isset($controlSection['enablecolumns']['disabled'])) { $dataMap->setDisabledFlagColumnName($controlSection['enablecolumns']['disabled']); } if (isset($controlSection['enablecolumns']['starttime'])) { $dataMap->setStartTimeColumnName($controlSection['enablecolumns']['starttime']); } if (isset($controlSection['enablecolumns']['endtime'])) { $dataMap->setEndTimeColumnName($controlSection['enablecolumns']['endtime']); } if (isset($controlSection['enablecolumns']['fe_group'])) { $dataMap->setFrontEndUserGroupColumnName($controlSection['enablecolumns']['fe_group']); } return $dataMap; }