TYPO3 CMS  TYPO3_6-2
OperatorTest.php
Go to the documentation of this file.
1 <?php
3 
18 
20 
24  protected $blogRepository;
25 
29  protected $postRepository;
30 
34  protected $testExtensionsToLoad = array('typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example');
35 
39  protected $coreExtensionsToLoad = array('extbase', 'fluid');
40 
44  protected $objectManager;
45 
49  public function setUp() {
50  parent::setUp();
51 
52  $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
53  $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/blogs.xml');
54  $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/posts.xml');
55  $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/tags.xml');
56  $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/post-tag-mm.xml');
57 
58  $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
59  $this->blogRepository = $this->objectManager->get('ExtbaseTeam\\BlogExample\\Domain\\Repository\\BlogRepository');
60  $this->postRepository = $this->objectManager->get('ExtbaseTeam\\BlogExample\\Domain\\Repository\\PostRepository');
61 
62  }
63 
67  public function equalsNullIsResolvedCorrectly() {
68  $query = $this->postRepository->createQuery();
69 
70  $query->matching(
71  $query->equals('title', NULL)
72  );
73 
74  $this->assertSame(0, $query->count());
75  }
76 
81  $query = $this->postRepository->createQuery();
82 
83  $query->matching(
84  $query->equals('title', 'PoSt1', FALSE)
85  );
86 
87  $this->assertSame(2, $query->count());
88  }
89 }