TYPO3 CMS  TYPO3_6-2
Typo3DbQueryParserTest.php
Go to the documentation of this file.
1 <?php
3 
18 
20 
24  public function addSysLanguageStatementWorksForDefaultLanguage() {
25  $table = $this->getUniqueId('tx_coretest_table');
26  $GLOBALS['TCA'][$table]['ctrl'] = array(
27  'languageField' => 'sys_language_uid'
28  );
30  $querySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings');
31  $sql = array();
32  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
33  $mockTypo3DbQueryParser->_callRef('addSysLanguageStatement', $table, $sql, $querySettings);
34  $expectedSql = array('additionalWhereClause' => array('(' . $table . '.sys_language_uid IN (0,-1))'));
35  $this->assertSame($expectedSql, $sql);
36  }
37 
41  public function addSysLanguageStatementWorksForNonDefaultLanguage() {
42  $table = $this->getUniqueId('tx_coretest_table');
43  $GLOBALS['TCA'][$table]['ctrl'] = array(
44  'languageField' => 'sys_language_uid'
45  );
46  $sql = array();
48  $querySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings', array('dummy'));
49  $querySettings->setLanguageUid('1');
50  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
51  $mockTypo3DbQueryParser->_callRef('addSysLanguageStatement', $table, $sql, $querySettings);
52  $result = array('additionalWhereClause' => array('(' . $table . '.sys_language_uid IN (1,-1))'));
53  $this->assertSame($result, $sql);
54  }
55 
60  $table = $this->getUniqueId('tx_coretest_table');
61  $GLOBALS['TCA'][$table]['ctrl'] = array(
62  'languageField' => 'sys_language_uid'
63  );
64  $sql = array();
65  $querySettings = new \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings();
66  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
67  $mockTypo3DbQueryParser->_callRef('addSysLanguageStatement', $table, $sql, $querySettings);
68  $expectedSql = array('additionalWhereClause' => array('(' . $table . '.sys_language_uid IN (0,-1))'));
69  $this->assertSame($expectedSql, $sql);
70  }
71 
76  $table = $this->getUniqueId('tx_coretest_table');
77  $GLOBALS['TCA'][$table]['ctrl'] = array(
78  'languageField' => 'sys_language_uid',
79  'delete' => 'deleted'
80  );
81  $sql = array();
82  $querySettings = new \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings();
83  $querySettings->setLanguageUid(0);
84  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
85  $mockTypo3DbQueryParser->_callRef('addSysLanguageStatement', $table, $sql, $querySettings);
86  $expectedSql = array('additionalWhereClause' => array('(' . $table . '.sys_language_uid IN (0,-1))'));
87  $this->assertSame($expectedSql, $sql);
88  }
89 
94  $table = $this->getUniqueId('tx_coretest_table');
95  $GLOBALS['TCA'][$table]['ctrl'] = array(
96  'languageField' => 'sys_language_uid'
97  );
98  $sql = array();
99  $querySettings = new \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings();
100  $querySettings->setLanguageUid(2);
101  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
102  $mockTypo3DbQueryParser->_callRef('addSysLanguageStatement', $table, $sql, $querySettings);
103  $expectedSql = array('additionalWhereClause' => array('(' . $table . '.sys_language_uid IN (2,-1))'));
104  $this->assertSame($expectedSql, $sql);
105  }
106 
111  $table = $this->getUniqueId('tx_coretest_table');
112  $GLOBALS['TCA'][$table]['ctrl'] = array(
113  'languageField' => 'sys_language_uid',
114  'transOrigPointerField' => 'l10n_parent'
115  );
116  $sql = array();
117  $querySettings = new \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings();
118  $querySettings->setLanguageUid(2);
119  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
120  $mockTypo3DbQueryParser->_callRef('addSysLanguageStatement', $table, $sql, $querySettings);
121  $expectedSql = array('additionalWhereClause' => array('(' . $table . '.sys_language_uid IN (2,-1) OR (' . $table . '.sys_language_uid=0 AND ' . $table . '.uid NOT IN (SELECT ' . $table . '.l10n_parent FROM ' . $table . ' WHERE ' . $table . '.l10n_parent>0 AND ' . $table . '.sys_language_uid=2)))'));
122  $this->assertSame($expectedSql, $sql);
123  }
124 
129  $table = $this->getUniqueId('tx_coretest_table');
130  $GLOBALS['TCA'][$table]['ctrl'] = array(
131  'languageField' => 'sys_language_uid',
132  'transOrigPointerField' => 'l10n_parent',
133  'delete' => 'deleted'
134  );
135  $sql = array();
136  $querySettings = new \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings();
137  $querySettings->setLanguageUid(2);
138  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
139  $mockTypo3DbQueryParser->_callRef('addSysLanguageStatement', $table, $sql, $querySettings);
140  $expectedSql = array('additionalWhereClause' => array(
141  '(' . $table . '.sys_language_uid IN (2,-1)' .
142  ' OR (' . $table . '.sys_language_uid=0 AND ' . $table . '.uid NOT IN (' .
143  'SELECT ' . $table . '.l10n_parent FROM ' . $table .
144  ' WHERE ' . $table . '.l10n_parent>0 AND ' .
145  $table . '.sys_language_uid=2 AND ' .
146  $table . '.deleted=0)))')
147  );
148  $this->assertSame($expectedSql, $sql);
149  }
150 
155  $table = $this->getUniqueId('tx_coretest_table');
156  $table = 'tt_content';
157  $GLOBALS['TCA'][$table]['ctrl'] = array(
158  'languageField' => 'sys_language_uid',
159  'transOrigPointerField' => 'l10n_parent',
160  'delete' => 'deleted'
161  );
162  $sql = array();
163  $querySettings = new \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings();
164  $querySettings->setLanguageUid(2);
165  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
166  $mockTypo3DbQueryParser->_callRef('addSysLanguageStatement', $table, $sql, $querySettings);
167  $expectedSql = array('additionalWhereClause' => array(
168  '(' . $table . '.sys_language_uid IN (2,-1)' .
169  ' OR (' . $table . '.sys_language_uid=0 AND ' . $table . '.uid NOT IN (' .
170  'SELECT ' . $table . '.l10n_parent FROM ' . $table .
171  ' WHERE ' . $table . '.l10n_parent>0 AND ' .
172  $table . '.sys_language_uid=2 AND ' .
173  $table . '.deleted=0)))')
174  );
175  $this->assertSame($expectedSql, $sql);
176  }
177 
181  public function orderStatementGenerationWorks() {
182  $mockSource = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\Selector', array('getNodeTypeName'), array(), '', FALSE);
183  $mockSource->expects($this->any())->method('getNodeTypeName')->will($this->returnValue('Tx_MyExt_ClassName'));
184  $mockDataMapper = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapper', array('convertPropertyNameToColumnName', 'convertClassNameToTableName'), array(), '', FALSE);
185  $mockDataMapper->expects($this->once())->method('convertClassNameToTableName')->with('Tx_MyExt_ClassName')->will($this->returnValue('tx_myext_tablename'));
186  $mockDataMapper->expects($this->once())->method('convertPropertyNameToColumnName')->with('fooProperty', 'Tx_MyExt_ClassName')->will($this->returnValue('converted_fieldname'));
187  $sql = array();
188  $orderings = array('fooProperty' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING);
189  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
190  $mockTypo3DbQueryParser->_set('dataMapper', $mockDataMapper);
191  $mockTypo3DbQueryParser->_callRef('parseOrderings', $orderings, $mockSource, $sql);
192  $expectedSql = array('orderings' => array('tx_myext_tablename.converted_fieldname ASC'));
193  $this->assertSame($expectedSql, $sql);
194  }
195 
201  $mockSource = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\Selector', array('getNodeTypeName'), array(), '', FALSE);
202  $mockSource->expects($this->never())->method('getNodeTypeName');
203  $mockDataMapper = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapper', array('convertPropertyNameToColumnName', 'convertClassNameToTableName'), array(), '', FALSE);
204  $mockDataMapper->expects($this->never())->method('convertClassNameToTableName');
205  $mockDataMapper->expects($this->never())->method('convertPropertyNameToColumnName');
206  $sql = array();
207  $orderings = array('fooProperty' => 'unsupported_order');
208  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
209  $mockTypo3DbQueryParser->_set('dataMapper', $mockDataMapper);
210  $mockTypo3DbQueryParser->_callRef('parseOrderings', $orderings, $mockSource, $sql);
211  }
212 
217  $mockSource = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\Selector', array('getNodeTypeName'), array(), '', FALSE);
218  $mockSource->expects($this->any())->method('getNodeTypeName')->will($this->returnValue('Tx_MyExt_ClassName'));
219  $mockDataMapper = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapper', array('convertPropertyNameToColumnName', 'convertClassNameToTableName'), array(), '', FALSE);
220  $mockDataMapper->expects($this->any())->method('convertClassNameToTableName')->with('Tx_MyExt_ClassName')->will($this->returnValue('tx_myext_tablename'));
221  $mockDataMapper->expects($this->any())->method('convertPropertyNameToColumnName')->will($this->returnValue('converted_fieldname'));
222  $sql = array();
223  $orderings = array(
224  'fooProperty' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING,
225  'barProperty' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
226  );
227  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
228  $mockTypo3DbQueryParser->_set('dataMapper', $mockDataMapper);
229  $mockTypo3DbQueryParser->_callRef('parseOrderings', $orderings, $mockSource, $sql);
230  $expectedSql = array('orderings' => array('tx_myext_tablename.converted_fieldname ASC', 'tx_myext_tablename.converted_fieldname DESC'));
231  $this->assertSame($expectedSql, $sql);
232  }
233 
235  return array(
236  'in be: include all' => array('BE', TRUE, array(), TRUE, NULL),
237  'in be: ignore enable fields but do not include deleted' => array('BE', TRUE, array(), FALSE, array('tx_foo_table.deleted_column=0')),
238  'in be: respect enable fields but include deleted' => array('BE', FALSE, array(), TRUE, array('tx_foo_table.disabled_column=0 AND (tx_foo_table.starttime_column<=123456789)')),
239  'in be: respect enable fields and do not include deleted' => array('BE', FALSE, array(), FALSE, array('tx_foo_table.disabled_column=0 AND (tx_foo_table.starttime_column<=123456789) AND tx_foo_table.deleted_column=0')),
240  'in fe: include all' => array('FE', TRUE, array(), TRUE, NULL),
241  'in fe: ignore enable fields but do not include deleted' => array('FE', TRUE, array(), FALSE, array('tx_foo_table.deleted_column=0')),
242  'in fe: ignore only starttime and do not include deleted' => array('FE', TRUE, array('starttime'), FALSE, array('tx_foo_table.deleted_column=0 AND tx_foo_table.disabled_column=0')),
243  'in fe: respect enable fields and do not include deleted' => array('FE', FALSE, array(), FALSE, array('tx_foo_table.deleted_column=0 AND tx_foo_table.disabled_column=0 AND tx_foo_table.starttime_column<=123456789'))
244  );
245  }
246 
251  public function visibilityConstraintStatementIsGeneratedAccordingToTheQuerySettings($mode, $ignoreEnableFields, $enableFieldsToBeIgnored, $deletedValue, $expectedSql) {
252  $tableName = 'tx_foo_table';
253  $GLOBALS['TCA'][$tableName]['ctrl'] = array(
254  'enablecolumns' => array(
255  'disabled' => 'disabled_column',
256  'starttime' => 'starttime_column'
257  ),
258  'delete' => 'deleted_column'
259  );
260  $GLOBALS['TSFE'] = new \stdClass();
261  $GLOBALS['TSFE']->sys_page = new \TYPO3\CMS\Frontend\Page\PageRepository();
262  $GLOBALS['SIM_ACCESS_TIME'] = 123456789;
263  $mockQuerySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings', array('getIgnoreEnableFields', 'getEnableFieldsToBeIgnored', 'getIncludeDeleted'), array(), '', FALSE);
264  $mockQuerySettings->expects($this->once())->method('getIgnoreEnableFields')->will($this->returnValue($ignoreEnableFields));
265  $mockQuerySettings->expects($this->once())->method('getEnableFieldsToBeIgnored')->will($this->returnValue($enableFieldsToBeIgnored));
266  $mockQuerySettings->expects($this->once())->method('getIncludeDeleted')->will($this->returnValue($deletedValue));
267  $sql = array();
268 
270  $mockEnvironmentService = $this->getMock('TYPO3\\CMS\\Extbase\\Service\\EnvironmentService', array('isEnvironmentInFrontendMode'));
271  $mockEnvironmentService->expects($this->any())->method('isEnvironmentInFrontendMode')->will($this->returnValue($mode == 'FE'));
272 
273  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
274  $mockTypo3DbQueryParser->_set('environmentService', $mockEnvironmentService);
275  $mockTypo3DbQueryParser->_callRef('addVisibilityConstraintStatement', $mockQuerySettings, $tableName, $sql);
276  $this->assertSame($expectedSql, $sql['additionalWhereClause']);
277  unset($GLOBALS['TCA'][$tableName]);
278  }
279 
280  public function providerForRespectEnableFields() {
281  return array(
282  'in be: respectEnableFields=false' => array('BE', FALSE, NULL),
283  'in be: respectEnableFields=true' => array('BE', TRUE, array('tx_foo_table.disabled_column=0 AND (tx_foo_table.starttime_column<=123456789) AND tx_foo_table.deleted_column=0')),
284  'in FE: respectEnableFields=false' => array('FE', FALSE, NULL),
285  'in FE: respectEnableFields=true' => array('FE', TRUE, array('tx_foo_table.deleted_column=0 AND tx_foo_table.disabled_column=0 AND tx_foo_table.starttime_column<=123456789'))
286  );
287  }
288 
293  public function respectEnableFieldsSettingGeneratesCorrectStatement($mode, $respectEnableFields, $expectedSql) {
294  $tableName = 'tx_foo_table';
295  $GLOBALS['TCA'][$tableName]['ctrl'] = array(
296  'enablecolumns' => array(
297  'disabled' => 'disabled_column',
298  'starttime' => 'starttime_column'
299  ),
300  'delete' => 'deleted_column'
301  );
302  $GLOBALS['TSFE'] = new \stdClass();
303  $GLOBALS['TSFE']->sys_page = new \TYPO3\CMS\Frontend\Page\PageRepository();
304  $GLOBALS['SIM_ACCESS_TIME'] = 123456789;
306  $mockQuerySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings', array('dummy'), array(), '', FALSE);
307  $mockQuerySettings->setIgnoreEnableFields(!$respectEnableFields);
308  $mockQuerySettings->setIncludeDeleted(!$respectEnableFields);
309  $sql = array();
310 
312  $mockEnvironmentService = $this->getMock('TYPO3\\CMS\\Extbase\\Service\\EnvironmentService', array('isEnvironmentInFrontendMode'));
313  $mockEnvironmentService->expects($this->any())->method('isEnvironmentInFrontendMode')->will($this->returnValue($mode == 'FE'));
314 
315  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
316  $mockTypo3DbQueryParser->_set('environmentService', $mockEnvironmentService);
317  $mockTypo3DbQueryParser->_callRef('addVisibilityConstraintStatement', $mockQuerySettings, $tableName, $sql);
318  $this->assertSame($expectedSql, $sql['additionalWhereClause']);
319  unset($GLOBALS['TCA'][$tableName]);
320  }
321 
326  public function visibilityConstraintStatementGenerationThrowsExceptionIfTheQuerySettingsAreInconsistent() {
327  $tableName = 'tx_foo_table';
328  $GLOBALS['TCA'][$tableName]['ctrl'] = array(
329  'enablecolumns' => array(
330  'disabled' => 'disabled_column'
331  ),
332  'delete' => 'deleted_column'
333  );
334  $mockQuerySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings', array('getIgnoreEnableFields', 'getEnableFieldsToBeIgnored', 'getIncludeDeleted'), array(), '', FALSE);
335  $mockQuerySettings->expects($this->once())->method('getIgnoreEnableFields')->will($this->returnValue(FALSE));
336  $mockQuerySettings->expects($this->once())->method('getEnableFieldsToBeIgnored')->will($this->returnValue(array()));
337  $mockQuerySettings->expects($this->once())->method('getIncludeDeleted')->will($this->returnValue(TRUE));
338  $sql = array();
339 
341  $mockEnvironmentService = $this->getMock('TYPO3\\CMS\\Extbase\\Service\\EnvironmentService', array('isEnvironmentInFrontendMode'));
342  $mockEnvironmentService->expects($this->any())->method('isEnvironmentInFrontendMode')->will($this->returnValue(TRUE));
343 
344  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
345  $mockTypo3DbQueryParser->_set('environmentService', $mockEnvironmentService);
346  $mockTypo3DbQueryParser->_callRef('addVisibilityConstraintStatement', $mockQuerySettings, $tableName, $sql);
347  unset($GLOBALS['TCA'][$tableName]);
348  }
353  $table = $this->getUniqueId('tx_coretest_table');
354  return array(
355  'set Pid to zero if rootLevel = 1' => array(
356  '1',
357  $table,
358  array('additionalWhereClause' => array($table . '.pid = 0'))
359  ),
360  'set Pid to given Pids if rootLevel = 0' => array(
361  '0',
362  $table,
363  array('additionalWhereClause' => array($table . '.pid IN (42,27)'))
364  ),
365  'set no statement if rootLevel = -1' => array(
366  '-1',
367  $table,
368  array()
369  )
370  );
371  }
372 
377  public function addPageIdStatementSetsPidToZeroIfTableDeclaresRootlevel($rootLevel, $table, $expectedSql) {
378 
379  $GLOBALS['TCA'][$table]['ctrl'] = array(
380  'rootLevel' => $rootLevel
381  );
382  $sql = array();
383  $storagePageIds = array(42,27);
384  $mockTypo3DbQueryParser = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser', array('dummy'), array(), '', FALSE);
385  $mockFrontendVariableCache = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\VariableFrontend', array(), array(), '', FALSE);
386  $mockDatabaseHandle = $this->prophesize('TYPO3\\CMS\\Core\\Database\\DatabaseConnection');
387  $mockDatabaseHandle->cleanIntArray(Argument::cetera())->willReturnArgument(0);
388  $mockTypo3DbQueryParser->_set('databaseHandle', $mockDatabaseHandle->reveal());
389  $mockTypo3DbQueryParser->_set('tableColumnCache', $mockFrontendVariableCache);
390  $mockFrontendVariableCache->expects($this->once())->method('get')->will($this->returnValue(array('pid' => '42')));
391  $mockTypo3DbQueryParser->_callRef('addPageIdStatement', $table, $sql, $storagePageIds);
392 
393  $this->assertSame($expectedSql, $sql);
394  }
395 
401  $mockTypo3DbQueryParser = $this->getAccessibleMock(
402  'TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser',
403  array('dummy'),
404  array(),
405  '',
406  FALSE
407  );
408  $mockTypo3DbQueryParser->_call('getPlainValue', array());
409  }
410 
415  $mockTypo3DbQueryParser = $this->getAccessibleMock(
416  'TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser',
417  array('dummy'),
418  array(),
419  '',
420  FALSE
421  );
422  $input = new \DateTime('@1365866253');
423  $this->assertSame('1365866253', $mockTypo3DbQueryParser->_call('getPlainValue', $input));
424  }
425 
430  $mockTypo3DbQueryParser = $this->getAccessibleMock(
431  'TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser',
432  array('dummy'),
433  array(),
434  '',
435  FALSE
436  );
437  $this->assertSame(1, $mockTypo3DbQueryParser->_call('getPlainValue', TRUE));
438  }
439 
444  $mockTypo3DbQueryParser = $this->getAccessibleMock(
445  'TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser',
446  array('dummy'),
447  array(),
448  '',
449  FALSE
450  );
451  $this->assertSame(0, $mockTypo3DbQueryParser->_call('getPlainValue', FALSE));
452  }
453 
459  $mockTypo3DbQueryParser = $this->getAccessibleMock(
460  'TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser',
461  array('dummy'),
462  array(),
463  '',
464  FALSE
465  );
466  $input = $this->getMock(
467  'TYPO3\\CMS\\Extbase\\Persistence\\Generic\\LazyLoadingProxy',
468  array(),
469  array(),
470  '',
471  FALSE
472  );
473  $input
474  ->expects($this->once())
475  ->method('_loadRealInstance');
476  $mockTypo3DbQueryParser->_call('getPlainValue', $input);
477  }
478 
483  $mockTypo3DbQueryParser = $this->getAccessibleMock(
484  'TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser',
485  array('dummy'),
486  array(),
487  '',
488  FALSE
489  );
490  $input = $this->getMock(
491  'TYPO3\\CMS\\Extbase\\DomainObject\\DomainObjectInterface',
492  array(),
493  array(),
494  '',
495  FALSE
496  );
497  $input
498  ->expects($this->once())
499  ->method('getUid')
500  ->will($this->returnValue(23));
501  $this->assertSame(23, $mockTypo3DbQueryParser->_call('getPlainValue', $input));
502  }
503 
507  public function getPlainValueReturnsSimpleType() {
508  $mockTypo3DbQueryParser = $this->getAccessibleMock(
509  'TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser',
510  array('dummy'),
511  array(),
512  '',
513  FALSE
514  );
515  $value = $this->getUniqueId('foo_');
516  $this->assertSame($value, $mockTypo3DbQueryParser->_call('getPlainValue', $value));
517  }
518 
519 }
$sql
Definition: server.php:82
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren&#39;t numeric.
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]