Example #1
0
 /**
  * @test
  */
 public function betweenSetsBoundariesCorrectly()
 {
     $query = $this->postRepository->createQuery();
     $query->setOrderings(array('uid' => QueryInterface::ORDER_ASCENDING));
     $query->matching($query->between('uid', 3, 5));
     $result = array_map(function ($row) {
         return $row['uid'];
     }, $query->execute(true));
     $this->assertEquals(array(3, 4, 5), $result);
 }
Example #2
0
 /**
  * @test
  */
 public function inConditionWorksWithLazyObjectStorageOnSecondCall()
 {
     $blog = $this->blogRepository->findByUid(1);
     $this->assertInstanceOf('\\TYPO3\\CMS\\Extbase\\Persistence\\Generic\\LazyObjectStorage', $blog->getPosts());
     $inQuery = $this->postRepository->createQuery();
     $inQuery->matching($inQuery->in('uid', $blog->getPosts()));
     $this->assertSame(10, $inQuery->count());
     $newInQuery = $this->postRepository->createQuery();
     $newInQuery->matching($newInQuery->in('uid', $blog->getPosts()));
     $this->assertSame(10, $newInQuery->count());
 }
Example #3
0
 /**
  * @test
  */
 public function equalsCorrectlyHandlesCaseSensivity()
 {
     $query = $this->postRepository->createQuery();
     $query->matching($query->equals('title', 'PoSt1', FALSE));
     $this->assertSame(2, $query->count());
 }
Example #4
0
 /**
  * Test if count works with subproperties in multiple left join.
  *
  * @test
  */
 public function subpropertyInMultipleLeftJoinCountTest()
 {
     $query = $this->postRepository->createQuery();
     $query->matching($query->logicalOr($query->equals('tags.uid', 1), $query->equals('tags.uid', 2)));
     $this->assertSame(10, $query->count());
 }