TYPO3 CMS  TYPO3_8-7
Typo3QuerySettingsTest.php
Go to the documentation of this file.
1 <?php
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 
20 class Typo3QuerySettingsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
21 {
26 
30  protected function setUp()
31  {
32  $this->typo3QuerySettings = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class, ['dummy']);
33  }
34 
38  public function booleanValueProvider()
39  {
40  return [
41  'TRUE setting' => [true],
42  'FALSE setting' => [false]
43  ];
44  }
45 
49  public function arrayValueProvider()
50  {
51  return [
52  'empty array' => [[]],
53  'two elements associative' => [
54  [
55  'one' => '42',
56  21 => 12
57  ]
58  ],
59  'three elements' => [
60  [
61  1,
62  'dummy',
63  []
64  ]
65  ]
66  ];
67  }
68 
75  {
76  $this->typo3QuerySettings->setRespectStoragePage($input);
77  $this->assertEquals($input, $this->typo3QuerySettings->getRespectStoragePage());
78  }
79 
84  {
85  $this->assertTrue($this->typo3QuerySettings->setRespectStoragePage(true) instanceof \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface);
86  }
87 
95  {
96  $this->typo3QuerySettings->setStoragePageIds($input);
97  $this->assertEquals($input, $this->typo3QuerySettings->getStoragePageIds());
98  }
99 
104  {
105  $this->assertTrue($this->typo3QuerySettings->setStoragePageIds([1, 2, 3]) instanceof \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface);
106  }
107 
115  {
116  $this->typo3QuerySettings->setRespectSysLanguage($input);
117  $this->assertEquals($input, $this->typo3QuerySettings->getRespectSysLanguage());
118  }
119 
124  {
125  $this->assertTrue($this->typo3QuerySettings->setRespectSysLanguage(true) instanceof \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface);
126  }
127 
132  {
133  $this->assertTrue($this->typo3QuerySettings->setLanguageUid(42) instanceof \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface);
134  }
135 
143  {
144  $this->typo3QuerySettings->setIgnoreEnableFields($input);
145  $this->assertEquals($input, $this->typo3QuerySettings->getIgnoreEnableFields());
146  }
147 
152  {
153  $this->assertTrue($this->typo3QuerySettings->setIgnoreEnableFields(true) instanceof \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface);
154  }
155 
163  {
164  $this->typo3QuerySettings->setEnableFieldsToBeIgnored($input);
165  $this->assertEquals($input, $this->typo3QuerySettings->getEnableFieldsToBeIgnored());
166  }
167 
172  {
173  $this->assertTrue($this->typo3QuerySettings->setEnableFieldsToBeIgnored(['starttime', 'endtime']) instanceof \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface);
174  }
175 
183  {
184  $this->typo3QuerySettings->setIncludeDeleted($input);
185  $this->assertEquals($input, $this->typo3QuerySettings->getIncludeDeleted());
186  }
187 
192  {
193  $this->assertTrue($this->typo3QuerySettings->setIncludeDeleted(true) instanceof \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface);
194  }
195 }