protected function createConstraint(Query $query, $queueName)
 {
     $constraints = array();
     $constraints[] = $query->equals('queueName', $queueName);
     $constraints[] = $query->equals('state', Message::STATE_PUBLISHED);
     $constraints[] = $query->logicalOr($query->equals('starttime', 0), $query->lessThanOrEqual('starttime', time()));
     $query->matching($query->logicalAnd($constraints));
 }
Example #2
0
 /**
  * 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);
 }
 /**
  * Adds default constraints to the query - in this case it
  * enables us to always just search for the latest version of an extension
  *
  * @param \TYPO3\CMS\Extbase\Persistence\Generic\Query $query the query to adjust
  * @return \TYPO3\CMS\Extbase\Persistence\Generic\Query
  */
 protected function addDefaultConstraints(\TYPO3\CMS\Extbase\Persistence\Generic\Query $query)
 {
     if ($query->getConstraint()) {
         $query->matching($query->logicalAnd($query->getConstraint(), $query->equals('current_version', TRUE)));
     } else {
         $query->matching($query->equals('current_version', TRUE));
     }
     return $query;
 }
 /**
  * Adds default constraints to the query - in this case it
  * enables us to always just search for the latest version of an extension
  *
  * @param \TYPO3\CMS\Extbase\Persistence\Generic\Query $query the query to adjust
  * @return \TYPO3\CMS\Extbase\Persistence\Generic\Query
  */
 protected function addDefaultConstraints(\TYPO3\CMS\Extbase\Persistence\Generic\Query $query)
 {
     if ($query->getConstraint()) {
         $query->matching($query->logicalAnd($query->getConstraint(), $query->equals('current_version', true), $query->greaterThanOrEqual('reviewState', 0)));
     } else {
         $query->matching($query->logicalAnd($query->equals('current_version', true), $query->greaterThanOrEqual('reviewState', 0)));
     }
     return $query;
 }