/** * Sets up this test case * * @return void */ protected function setUp() { $this->query = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Query::class, array('dummy'), array('someType')); $this->querySettings = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class); $this->query->_set('querySettings', $this->querySettings); $this->persistenceManager = $this->getMock(\TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface::class); $this->backend = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface::class); $this->query->_set('persistenceManager', $this->persistenceManager); $this->dataMapper = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::class); $this->query->_set('dataMapper', $this->dataMapper); $this->controller = $this->getAccessibleMock(\TYPO3\CMS\Fluid\ViewHelpers\Widget\Controller\PaginateController::class, array('dummy'), array(), '', false); $this->controller->_set('view', $this->getMock(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class)); }
/** * Sets up this test case * * @return void */ protected function setUp() { $this->query = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Query::class, array('dummy'), array('someType')); $this->querySettings = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class); $this->query->_set('querySettings', $this->querySettings); $this->persistenceManager = $this->getMock(\TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface::class); $this->backend = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface::class); $this->backend->expects($this->any())->method('getQomFactory')->will($this->returnValue(NULL)); $this->persistenceManager->expects($this->any())->method('getBackend')->will($this->returnValue($this->backend)); $this->query->_set('persistenceManager', $this->persistenceManager); $this->dataMapper = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::class); $this->query->_set('dataMapper', $this->dataMapper); $this->controller = $this->getAccessibleMock(\TYPO3\CMS\Fluid\ViewHelpers\Widget\Controller\PaginateController::class, array('dummy'), array(), '', FALSE); $this->controller->_set('view', $this->getMock(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class)); }
/** * Checks if equals condition makes utf-8 argument lowercase correctly * * @test * @dataProvider equalsForCaseSensitiveFalseLowercasesOperandProvider * @param string $propertyName The name of the property to compare against * @param mixed $operand The value to compare with * @param string $expectedOperand */ public function equalsForCaseSensitiveFalseLowercasesOperand($propertyName, $operand, $expectedOperand) { /** @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */ $objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManager::class); /** @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $dynamicOperand */ $dynamicOperand = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\PropertyValueInterface::class); $objectManager->expects($this->any())->method('get')->will($this->returnValue($dynamicOperand)); /** @var $qomFactory \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelFactory */ $qomFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelFactory::class, array('comparison')); $qomFactory->_set('objectManager', $objectManager); $qomFactory->expects($this->once())->method('comparison')->with($this->anything(), $this->anything(), $expectedOperand); $this->query->_set('qomFactory', $qomFactory); $this->query->equals($propertyName, $operand, false); }