TYPO3 CMS  TYPO3_8-7
DataHandlerTest.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 
26 
30 class DataHandlerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
31 {
35  protected $singletonInstances = [];
36 
40  protected $subject;
41 
45  protected $backEndUser;
46 
50  protected function setUp()
51  {
52  $GLOBALS['TCA'] = [];
53  $this->singletonInstances = GeneralUtility::getSingletonInstances();
54  $this->backEndUser = $this->createMock(BackendUserAuthentication::class);
55  $this->subject = $this->getAccessibleMock(DataHandler::class, ['dummy']);
56  $this->subject->start([], '', $this->backEndUser);
57  }
58 
62  protected function tearDown()
63  {
64  GeneralUtility::resetSingletonInstances($this->singletonInstances);
65  parent::tearDown();
66  }
67 
69  // Tests for the basic functionality
71 
74  public function fixtureCanBeCreated()
75  {
76  $this->assertTrue($this->subject instanceof DataHandler);
77  }
78 
80  // Test concerning checkModifyAccessList
82 
86  {
87  $this->subject->admin = true;
88  $this->assertTrue($this->subject->checkModifyAccessList('tt_content'));
89  }
90 
95  {
96  $this->subject->admin = false;
97  $this->assertFalse($this->subject->checkModifyAccessList('tt_content'));
98  }
99 
104  {
105  $this->subject->admin = false;
106  $this->backEndUser->groupData['tables_modify'] = 'tt_content';
107  $this->assertTrue($this->subject->checkModifyAccessList('tt_content'));
108  }
109 
114  {
115  $this->subject->admin = true;
116  $this->assertTrue($this->subject->checkModifyAccessList('be_users'));
117  }
118 
123  {
124  $this->subject->admin = false;
125  $this->assertFalse($this->subject->checkModifyAccessList('be_users'));
126  }
127 
132  {
133  $tableName = $this->getUniqueId('aTable');
134  $GLOBALS['TCA'] = [
135  $tableName => [
136  'ctrl' => [
137  'adminOnly' => true,
138  ],
139  ],
140  ];
141  $this->subject->admin = false;
142  $this->backEndUser->groupData['tables_modify'] = $tableName;
143  $this->assertFalse($this->subject->checkModifyAccessList($tableName));
144  }
145 
149  public function evalCheckValueDouble2()
150  {
151  $testData = [
152  '-0,5' => '-0.50',
153  '1000' => '1000.00',
154  '1000,10' => '1000.10',
155  '1000,0' => '1000.00',
156  '600.000.000,00' => '600000000.00',
157  '60aaa00' => '6000.00'
158  ];
159  foreach ($testData as $value => $expectedReturnValue) {
160  $returnValue = $this->subject->checkValue_input_Eval($value, ['double2'], '');
161  $this->assertSame($returnValue['value'], $expectedReturnValue);
162  }
163  }
164 
165  public function dataProviderDatetime()
166  {
167  // Three elements: input, timezone of input, expected output (UTC)
168  return [
169  'timestamp is passed through, as it is UTC' => [
170  1457103519, 'Europe/Berlin', 1457103519
171  ],
172  'ISO date is interpreted as local date and is output as correct timestamp' => [
173  '2017-06-07T00:10:00Z', 'Europe/Berlin', 1496787000
174  ],
175  ];
176  }
177 
182  public function evalCheckValueDatetime($input, $serverTimezone, $expectedOutput)
183  {
184  $oldTimezone = date_default_timezone_get();
185  date_default_timezone_set($serverTimezone);
186 
187  $output = $this->subject->checkValue_input_Eval($input, ['datetime'], '');
188 
189  // set before the assertion is performed, so it is restored even for failing tests
190  date_default_timezone_set($oldTimezone);
191 
192  $this->assertEquals($expectedOutput, $output['value']);
193  }
194 
201  {
202  return [
203  '"0" returns zero as integer' => [
204  '0',
205  0
206  ],
207  '"-2000001" is interpreted correctly as -2000001 but is lower than -2000000 and set to -2000000' => [
208  '-2000001',
209  -2000000
210  ],
211  '"-2000000" is interpreted correctly as -2000000 and is equal to -2000000' => [
212  '-2000000',
213  -2000000
214  ],
215  '"2000000" is interpreted correctly as 2000000 and is equal to 2000000' => [
216  '2000000',
217  2000000
218  ],
219  '"2000001" is interpreted correctly as 2000001 but is greater then 2000000 and set to 2000000' => [
220  '2000001',
221  2000000
222  ],
223  ];
224  }
225 
232  public function inputValueCheckRecognizesStringValuesAsIntegerValuesCorrectly($value, $expectedReturnValue)
233  {
234  $tcaFieldConf = [
235  'input' => [],
236  'eval' => 'int',
237  'range' => [
238  'lower' => '-2000000',
239  'upper' => '2000000'
240  ]
241  ];
242  $returnValue = $this->subject->_call('checkValueForInput', $value, $tcaFieldConf, '', 0, 0, '');
243  $this->assertSame($returnValue['value'], $expectedReturnValue);
244  }
245 
250  {
251  return [
252  'undershot date adjusted' => [
253  '2018-02-28T00:00:00Z',
254  1519862400,
255  ],
256  'exact lower date accepted' => [
257  '2018-03-01T00:00:00Z',
258  1519862400,
259  ],
260  'exact upper date accepted' => [
261  '2018-03-31T23:59:59Z',
262  1522540799,
263  ],
264  'exceeded date adjusted' => [
265  '2018-04-01T00:00:00Z',
266  1522540799,
267  ],
268  ];
269  }
270 
279  {
280  $tcaFieldConf = [
281  'input' => [],
282  'eval' => 'datetime',
283  'range' => [
284  // unix timestamp: 1519862400
285  'lower' => gmmktime(0, 0, 0, 3, 1, 2018),
286  // unix timestamp: 1522540799
287  'upper' => gmmktime(23, 59, 59, 3, 31, 2018),
288  ]
289  ];
290 
291  // @todo Switch to UTC since otherwise DataHandler removes timezone offset
292  $previousTimezone = date_default_timezone_get();
293  date_default_timezone_set('UTC');
294 
295  $returnValue = $this->subject->_call('checkValueForInput', $value, $tcaFieldConf, '', 0, 0, '');
296 
297  date_default_timezone_set($previousTimezone);
298 
299  $this->assertSame($returnValue['value'], $expected);
300  }
301 
306  {
307  return [
308  'tca without dbType' => [
309  [
310  'input' => []
311  ]
312  ],
313  'tca with dbType != date/datetime' => [
314  [
315  'input' => [],
316  'dbType' => 'foo'
317  ]
318  ]
319  ];
320  }
321 
328  {
329  $this->subject->_call('checkValueForInput', '', $tcaFieldConf, '', 0, 0, '');
330  }
331 
333  // Tests concerning checkModifyAccessList
335  //
341  {
342  $this->expectException(\UnexpectedValueException::class);
343  $this->expectExceptionCode(1251892472);
344 
345  $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'][] = InvalidHookFixture::class;
346  $this->subject->checkModifyAccessList('tt_content');
347  }
348 
355  {
356  $hookClass = $this->getUniqueId('tx_coretest');
357  $hookMock = $this->getMockBuilder(\TYPO3\CMS\Core\DataHandling\DataHandlerCheckModifyAccessListHookInterface::class)
358  ->setMethods(['checkModifyAccessList'])
359  ->setMockClassName($hookClass)
360  ->getMock();
361  $hookMock->expects($this->once())->method('checkModifyAccessList');
362  $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'][] = $hookClass;
363  GeneralUtility::addInstance($hookClass, $hookMock);
364  $this->subject->checkModifyAccessList('tt_content');
365  }
366 
373  {
374  $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'][] = AllowAccessHookFixture::class;
375  $this->assertTrue($this->subject->checkModifyAccessList('tt_content'));
376  }
377 
379  // Tests concerning process_datamap
381 
384  public function processDatamapForFrozenNonZeroWorkspaceReturnsFalse()
385  {
387  $subject = $this->getMockBuilder(DataHandler::class)
388  ->setMethods(['newlog'])
389  ->getMock();
390  $this->backEndUser->workspace = 1;
391  $this->backEndUser->workspaceRec = ['freeze' => true];
392  $subject->BE_USER = $this->backEndUser;
393  $this->assertFalse($subject->process_datamap());
394  }
395 
399  public function processDatamapWhenEditingRecordInWorkspaceCreatesNewRecordInWorkspace()
400  {
401  $GLOBALS['TCA'] = [
402  'pages' => [
403  'columns' => [],
404  ],
405  ];
406 
408  $subject = $this->getMockBuilder(DataHandler::class)
409  ->setMethods([
410  'newlog',
411  'checkModifyAccessList',
412  'tableReadOnly',
413  'checkRecordUpdateAccess',
414  'recordInfo',
415  'getCacheManager',
416  'registerElementsToBeDeleted',
417  'unsetElementsToBeDeleted',
418  'resetElementsToBeDeleted'
419  ])
420  ->disableOriginalConstructor()
421  ->getMock();
422 
423  $subject->bypassWorkspaceRestrictions = false;
424  $subject->datamap = [
425  'pages' => [
426  '1' => [
427  'header' => 'demo'
428  ]
429  ]
430  ];
431 
432  $cacheManagerMock = $this->getMockBuilder(CacheManager::class)
433  ->setMethods(['flushCachesInGroupByTags'])
434  ->getMock();
435  $cacheManagerMock->expects($this->once())->method('flushCachesInGroupByTags')->with('pages', []);
436 
437  $subject->expects($this->once())->method('getCacheManager')->willReturn($cacheManagerMock);
438  $subject->expects($this->once())->method('recordInfo')->will($this->returnValue(null));
439  $subject->expects($this->once())->method('checkModifyAccessList')->with('pages')->will($this->returnValue(true));
440  $subject->expects($this->once())->method('tableReadOnly')->with('pages')->will($this->returnValue(false));
441  $subject->expects($this->once())->method('checkRecordUpdateAccess')->will($this->returnValue(true));
442  $subject->expects($this->once())->method('unsetElementsToBeDeleted')->willReturnArgument(0);
443 
445  $backEndUser = $this->createMock(BackendUserAuthentication::class);
446  $backEndUser->workspace = 1;
447  $backEndUser->workspaceRec = ['freeze' => false];
448  $backEndUser->expects($this->once())->method('workspaceAllowAutoCreation')->will($this->returnValue(true));
449  $backEndUser->expects($this->once())->method('workspaceCannotEditRecord')->will($this->returnValue(true));
450  $backEndUser->expects($this->once())->method('recordEditAccessInternals')->with('pages', 1)->will($this->returnValue(true));
451  $subject->BE_USER = $backEndUser;
452  $createdDataHandler = $this->createMock(DataHandler::class);
453  $createdDataHandler->expects($this->once())->method('start')->with([], [
454  'pages' => [
455  1 => [
456  'version' => [
457  'action' => 'new',
458  'label' => 'Auto-created for WS #1'
459  ]
460  ]
461  ]
462  ]);
463  $createdDataHandler->expects($this->never())->method('process_datamap');
464  $createdDataHandler->expects($this->once())->method('process_cmdmap');
465  GeneralUtility::addInstance(DataHandler::class, $createdDataHandler);
466  $subject->process_datamap();
467  }
468 
473  {
474  $hookClass = $this->getUniqueId('tx_coretest');
475  $hookMock = $this->getMockBuilder($hookClass)
476  ->setMethods(['checkFlexFormValue_beforeMerge'])
477  ->getMock();
478  $hookMock->expects($this->once())->method('checkFlexFormValue_beforeMerge');
479  $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkFlexFormValue'][] = $hookClass;
480  GeneralUtility::addInstance($hookClass, $hookMock);
481  $flexFormToolsProphecy = $this->prophesize(FlexFormTools::class);
482  $flexFormToolsProphecy->getDataStructureIdentifier(Argument::cetera())->willReturn('anIdentifier');
483  $flexFormToolsProphecy->parseDataStructureByIdentifier('anIdentifier')->willReturn([]);
484  GeneralUtility::addInstance(FlexFormTools::class, $flexFormToolsProphecy->reveal());
485  $this->subject->_call('checkValueForFlex', [], [], [], '', 0, '', '', 0, 0, 0, [], '');
486  }
487 
489  // Tests concerning log
491 
495  {
496  $backendUser = $this->createMock(BackendUserAuthentication::class);
497  $backendUser->expects($this->once())->method('writelog');
498  $this->subject->enableLogging = true;
499  $this->subject->BE_USER = $backendUser;
500  $this->subject->log('', 23, 0, 42, 0, 'details');
501  }
502 
507  {
508  $backendUser = $this->createMock(BackendUserAuthentication::class);
509  $backendUser->expects($this->never())->method('writelog');
510  $this->subject->enableLogging = false;
511  $this->subject->BE_USER = $backendUser;
512  $this->subject->log('', 23, 0, 42, 0, 'details');
513  }
514 
519  {
520  $backendUser = $this->createMock(BackendUserAuthentication::class);
521  $this->subject->BE_USER = $backendUser;
522  $this->subject->enableLogging = true;
523  $this->subject->errorLog = [];
524  $logDetailsUnique = $this->getUniqueId('details');
525  $this->subject->log('', 23, 0, 42, 1, $logDetailsUnique);
526  $this->assertStringEndsWith($logDetailsUnique, $this->subject->errorLog[0]);
527  }
528 
533  {
534  $backendUser = $this->createMock(BackendUserAuthentication::class);
535  $this->subject->BE_USER = $backendUser;
536  $this->subject->enableLogging = true;
537  $this->subject->errorLog = [];
538  $logDetails = $this->getUniqueId('details');
539  $this->subject->log('', 23, 0, 42, 1, '%1$s' . $logDetails . '%2$s', -1, ['foo', 'bar']);
540  $expected = 'foo' . $logDetails . 'bar';
541  $this->assertStringEndsWith($expected, $this->subject->errorLog[0]);
542  }
543 
554  public function equalSubmittedAndStoredValuesAreDetermined($expected, $submittedValue, $storedValue, $storedType, $allowNull)
555  {
556  $result = $this->callInaccessibleMethod(
557  $this->subject,
558  'isSubmittedValueEqualToStoredValue',
559  $submittedValue,
560  $storedValue,
561  $storedType,
562  $allowNull
563  );
564  $this->assertEquals($expected, $result);
565  }
566 
571  {
572  return [
573  // String
574  'string value "" vs. ""' => [
575  true,
576  '', '', 'string', false
577  ],
578  'string value 0 vs. "0"' => [
579  true,
580  0, '0', 'string', false
581  ],
582  'string value 1 vs. "1"' => [
583  true,
584  1, '1', 'string', false
585  ],
586  'string value "0" vs. ""' => [
587  false,
588  '0', '', 'string', false
589  ],
590  'string value 0 vs. ""' => [
591  false,
592  0, '', 'string', false
593  ],
594  'string value null vs. ""' => [
595  true,
596  null, '', 'string', false
597  ],
598  // Integer
599  'integer value 0 vs. 0' => [
600  true,
601  0, 0, 'int', false
602  ],
603  'integer value "0" vs. "0"' => [
604  true,
605  '0', '0', 'int', false
606  ],
607  'integer value 0 vs. "0"' => [
608  true,
609  0, '0', 'int', false
610  ],
611  'integer value "" vs. "0"' => [
612  true,
613  '', '0', 'int', false
614  ],
615  'integer value "" vs. 0' => [
616  true,
617  '', 0, 'int', false
618  ],
619  'integer value "0" vs. 0' => [
620  true,
621  '0', 0, 'int', false
622  ],
623  'integer value 1 vs. 1' => [
624  true,
625  1, 1, 'int', false
626  ],
627  'integer value 1 vs. "1"' => [
628  true,
629  1, '1', 'int', false
630  ],
631  'integer value "1" vs. "1"' => [
632  true,
633  '1', '1', 'int', false
634  ],
635  'integer value "1" vs. 1' => [
636  true,
637  '1', 1, 'int', false
638  ],
639  'integer value "0" vs. "1"' => [
640  false,
641  '0', '1', 'int', false
642  ],
643  // String with allowed NULL values
644  'string with allowed null value "" vs. ""' => [
645  true,
646  '', '', 'string', true
647  ],
648  'string with allowed null value 0 vs. "0"' => [
649  true,
650  0, '0', 'string', true
651  ],
652  'string with allowed null value 1 vs. "1"' => [
653  true,
654  1, '1', 'string', true
655  ],
656  'string with allowed null value "0" vs. ""' => [
657  false,
658  '0', '', 'string', true
659  ],
660  'string with allowed null value 0 vs. ""' => [
661  false,
662  0, '', 'string', true
663  ],
664  'string with allowed null value null vs. ""' => [
665  false,
666  null, '', 'string', true
667  ],
668  'string with allowed null value "" vs. null' => [
669  false,
670  '', null, 'string', true
671  ],
672  'string with allowed null value null vs. null' => [
673  true,
674  null, null, 'string', true
675  ],
676  // Integer with allowed NULL values
677  'integer with allowed null value 0 vs. 0' => [
678  true,
679  0, 0, 'int', true
680  ],
681  'integer with allowed null value "0" vs. "0"' => [
682  true,
683  '0', '0', 'int', true
684  ],
685  'integer with allowed null value 0 vs. "0"' => [
686  true,
687  0, '0', 'int', true
688  ],
689  'integer with allowed null value "" vs. "0"' => [
690  true,
691  '', '0', 'int', true
692  ],
693  'integer with allowed null value "" vs. 0' => [
694  true,
695  '', 0, 'int', true
696  ],
697  'integer with allowed null value "0" vs. 0' => [
698  true,
699  '0', 0, 'int', true
700  ],
701  'integer with allowed null value 1 vs. 1' => [
702  true,
703  1, 1, 'int', true
704  ],
705  'integer with allowed null value "1" vs. "1"' => [
706  true,
707  '1', '1', 'int', true
708  ],
709  'integer with allowed null value "1" vs. 1' => [
710  true,
711  '1', 1, 'int', true
712  ],
713  'integer with allowed null value 1 vs. "1"' => [
714  true,
715  1, '1', 'int', true
716  ],
717  'integer with allowed null value "0" vs. "1"' => [
718  false,
719  '0', '1', 'int', true
720  ],
721  'integer with allowed null value null vs. ""' => [
722  false,
723  null, '', 'int', true
724  ],
725  'integer with allowed null value "" vs. null' => [
726  false,
727  '', null, 'int', true
728  ],
729  'integer with allowed null value null vs. null' => [
730  true,
731  null, null, 'int', true
732  ],
733  'integer with allowed null value null vs. "0"' => [
734  false,
735  null, '0', 'int', true
736  ],
737  'integer with allowed null value null vs. 0' => [
738  false,
739  null, 0, 'int', true
740  ],
741  'integer with allowed null value "0" vs. null' => [
742  false,
743  '0', null, 'int', true
744  ],
745  ];
746  }
747 
754  public function getPlaceholderTitleForTableLabelReturnsLabelThatsMatchesLabelFieldConditions($expected, $eval)
755  {
756  $table = 'phpunit_dummy';
757 
759  $subject = $this->getAccessibleMock(
760  DataHandler::class,
761  ['dummy']
762  );
763 
764  $backendUser = $this->createMock(BackendUserAuthentication::class);
765  $subject->BE_USER = $backendUser;
766  $subject->BE_USER->workspace = 1;
767 
768  $GLOBALS['TCA'][$table] = [];
769  $GLOBALS['TCA'][$table]['ctrl'] = ['label' => 'dummy'];
770  $GLOBALS['TCA'][$table]['columns'] = [
771  'dummy' => [
772  'config' => [
773  'eval' => $eval
774  ]
775  ]
776  ];
777 
778  $this->assertEquals($expected, $subject->_call('getPlaceholderTitleForTableLabel', $table));
779  }
780 
785  {
786  return [
787  [
788  0.10,
789  'double2'
790  ],
791  [
792  0,
793  'int'
794  ],
795  [
796  '0',
797  'datetime'
798  ],
799  [
800  '[PLACEHOLDER, WS#1]',
801  ''
802  ]
803  ];
804  }
805 
809  public function deletePagesOnRootLevelIsDenied()
810  {
812  $dataHandlerMock = $this->getMockBuilder(DataHandler::class)
813  ->setMethods(['canDeletePage', 'newlog2'])
814  ->getMock();
815  $dataHandlerMock
816  ->expects($this->never())
817  ->method('canDeletePage');
818  $dataHandlerMock
819  ->expects($this->once())
820  ->method('newlog2')
821  ->with('Deleting all pages starting from the root-page is disabled.', 'pages', 0, 0, 2);
822 
823  $dataHandlerMock->deletePages(0);
824  }
825 
829  public function deleteRecord_procBasedOnFieldTypeRespectsEnableCascadingDelete()
830  {
831  $table = $this->getUniqueId('foo_');
832  $conf = [
833  'type' => 'inline',
834  'foreign_table' => $this->getUniqueId('foreign_foo_'),
835  'behaviour' => [
836  'enableCascadingDelete' => 0,
837  ]
838  ];
839 
841  $mockRelationHandler = $this->createMock(\TYPO3\CMS\Core\Database\RelationHandler::class);
842  $mockRelationHandler->itemArray = [
843  '1' => ['table' => $this->getUniqueId('bar_'), 'id' => 67]
844  ];
845 
847  $mockDataHandler = $this->getAccessibleMock(DataHandler::class, ['getInlineFieldType', 'deleteAction', 'createRelationHandlerInstance'], [], '', false);
848  $mockDataHandler->expects($this->once())->method('getInlineFieldType')->will($this->returnValue('field'));
849  $mockDataHandler->expects($this->once())->method('createRelationHandlerInstance')->will($this->returnValue($mockRelationHandler));
850  $mockDataHandler->expects($this->never())->method('deleteAction');
851  $mockDataHandler->deleteRecord_procBasedOnFieldType($table, 42, 'foo', 'bar', $conf);
852  }
853 
858  {
859  return [
860  'None item selected' => [
861  0,
862  0
863  ],
864  'All items selected' => [
865  7,
866  7
867  ],
868  'Item 1 and 2 are selected' => [
869  3,
870  3
871  ],
872  'Value is higher than allowed (all checkboxes checked)' => [
873  15,
874  7
875  ],
876  'Value is higher than allowed (some checkboxes checked)' => [
877  11,
878  3
879  ],
880  'Negative value' => [
881  -5,
882  0
883  ]
884  ];
885  }
886 
894  public function checkValue_checkReturnsExpectedValues($value, $expectedValue)
895  {
896  $expectedResult = [
897  'value' => $expectedValue
898  ];
899  $result = [];
900  $tcaFieldConfiguration = [
901  'items' => [
902  ['Item 1', 0],
903  ['Item 2', 0],
904  ['Item 3', 0]
905  ]
906  ];
907  $this->assertSame($expectedResult, $this->subject->_call('checkValueForCheck', $result, $value, $tcaFieldConfiguration, '', 0, 0, ''));
908  }
909 
914  {
915  $previousLanguageService = $GLOBALS['LANG'];
916  $GLOBALS['LANG'] = GeneralUtility::makeInstance(\TYPO3\CMS\Lang\LanguageService::class);
917  $GLOBALS['LANG']->init('default');
918  $expectedResult = ['value' => ''];
919  $this->assertSame($expectedResult, $this->subject->_call('checkValueForInput', null, ['type' => 'string', 'max' => 40], 'tt_content', 'NEW55c0e67f8f4d32.04974534', 89, 'table_caption'));
920  $GLOBALS['LANG'] = $previousLanguageService;
921  }
922 
930  public function referenceValuesAreCasted($value, array $configuration, $expected)
931  {
932  $this->assertEquals(
933  $expected,
934  $this->subject->_call('castReferenceValue', $value, $configuration)
935  );
936  }
937 
942  {
943  return [
944  'all empty' => [
945  '', [], ''
946  ],
947  'cast zero with MM table' => [
948  '', ['MM' => 'table'], 0
949  ],
950  'cast zero with MM table with default value' => [
951  '', ['MM' => 'table', 'default' => 13], 0
952  ],
953  'cast zero with foreign field' => [
954  '', ['foreign_field' => 'table', 'default' => 13], 0
955  ],
956  'cast zero with foreign field with default value' => [
957  '', ['foreign_field' => 'table'], 0
958  ],
959  'pass zero' => [
960  '0', [], '0'
961  ],
962  'pass value' => [
963  '1', ['default' => 13], '1'
964  ],
965  'use default value' => [
966  '', ['default' => 13], 13
967  ],
968  ];
969  }
970 }
inputValueCheckRecognizesDateTimeValuesAsIntegerValuesCorrectly($value, int $expected)
static addInstance($className, $instance)
equalSubmittedAndStoredValuesAreDetermined($expected, $submittedValue, $storedValue, $storedType, $allowNull)
static makeInstance($className,... $constructorArguments)
static resetSingletonInstances(array $newSingletonInstances)
inputValueCheckRecognizesStringValuesAsIntegerValuesCorrectly($value, $expectedReturnValue)
referenceValuesAreCasted($value, array $configuration, $expected)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']
evalCheckValueDatetime($input, $serverTimezone, $expectedOutput)