[TASK] Use name-resolution instead of strings where possible: 17
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Functional / Persistence / OperatorTest.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Tests\Functional\Persistence;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Core\Utility\GeneralUtility;
18
19 class OperatorTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
20
21 /**
22 * @var \ExtbaseTeam\BlogExample\Domain\Repository\BlogRepository
23 */
24 protected $blogRepository;
25
26 /**
27 * @var \ExtbaseTeam\BlogExample\Domain\Repository\PostRepository
28 */
29 protected $postRepository;
30
31 /**
32 * @var array
33 */
34 protected $testExtensionsToLoad = array('typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example');
35
36 /**
37 * @var array
38 */
39 protected $coreExtensionsToLoad = array('extbase', 'fluid');
40
41 /**
42 * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface The object manager
43 */
44 protected $objectManager;
45
46 /**
47 * Sets up this test suite.
48 */
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::class);
59 $this->blogRepository = $this->objectManager->get(\ExtbaseTeam\BlogExample\Domain\Repository\BlogRepository::class);
60 $this->postRepository = $this->objectManager->get(\ExtbaseTeam\BlogExample\Domain\Repository\PostRepository::class);
61
62 }
63
64 /**
65 * @test
66 */
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
77 /**
78 * @test
79 */
80 public function equalsCorrectlyHandlesCaseSensivity() {
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 }