TYPO3 CMS  TYPO3_7-6
DataMapFactoryTest.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 
21 
26 {
30  public function oneToOneRelation()
31  {
32  return [
33  ['Tx_Myext_Domain_Model_Foo'],
34  [\TYPO3\CMS\Extbase\Domain\Model\FrontendUser::class]
35  ];
36  }
37 
42  public function setRelationsDetectsOneToOneRelation($className)
43  {
44  $mockColumnMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, [], [], '', false);
45  $columnConfiguration = [
46  'type' => 'select',
47  'foreign_table' => 'tx_myextension_bar',
48  'foreign_field' => 'parentid'
49  ];
50  $propertyMetaData = [
51  'type' => $className,
52  'elementType' => null
53  ];
54  $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['setOneToOneRelation', 'setOneToManyRelation', 'setManyToManyRelation'], [], '', false);
55  $mockDataMapFactory->expects($this->once())->method('setOneToOneRelation')->will($this->returnValue($mockColumnMap));
56  $mockDataMapFactory->expects($this->never())->method('setOneToManyRelation');
57  $mockDataMapFactory->expects($this->never())->method('setManyToManyRelation');
58  $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $propertyMetaData);
59  }
60 
65  {
66  $mockColumnMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, [], [], '', false);
67  $matchFields = [
68  'fieldname' => 'foo_model'
69  ];
70  $columnConfiguration = [
71  'type' => 'select',
72  'foreign_table' => 'tx_myextension_bar',
73  'foreign_field' => 'parentid',
74  'foreign_match_fields' => $matchFields
75  ];
76 
77  $mockColumnMap->expects($this->once())
78  ->method('setRelationTableMatchFields')
79  ->with($matchFields);
80  $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['dummy'], [], '', false);
81  $mockDataMapFactory->_call('setOneToOneRelation', $mockColumnMap, $columnConfiguration);
82  }
83 
88  {
89  $mockColumnMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, [], [], '', false);
90  $matchFields = [
91  'fieldname' => 'foo_model'
92  ];
93  $columnConfiguration = [
94  'type' => 'select',
95  'foreign_table' => 'tx_myextension_bar',
96  'foreign_field' => 'parentid',
97  'foreign_match_fields' => $matchFields
98  ];
99 
100  $mockColumnMap->expects($this->once())
101  ->method('setRelationTableMatchFields')
102  ->with($matchFields);
103  $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['dummy'], [], '', false);
104  $mockDataMapFactory->_call('setOneToManyRelation', $mockColumnMap, $columnConfiguration);
105  }
106 
111  {
112  $mockColumnMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, [], [], '', false);
113  $columnConfiguration = [
114  'type' => 'select',
115  'foreign_table' => 'tx_myextension_bar',
116  'MM' => 'tx_myextension_mm'
117  ];
118  $propertyMetaData = [
119  'type' => 'Tx_Myext_Domain_Model_Foo',
120  'elementType' => null
121  ];
122  $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['setOneToOneRelation', 'setOneToManyRelation', 'setManyToManyRelation'], [], '', false);
123  $mockDataMapFactory->expects($this->never())->method('setOneToOneRelation');
124  $mockDataMapFactory->expects($this->never())->method('setOneToManyRelation');
125  $mockDataMapFactory->expects($this->once())->method('setManyToManyRelation')->will($this->returnValue($mockColumnMap));
126  $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $propertyMetaData);
127  }
128 
133  {
134  $mockColumnMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, [], [], '', false);
135  $columnConfiguration = [
136  'type' => 'select',
137  'foreign_table' => 'tx_myextension_bar',
138  'foreign_field' => 'parentid',
139  'foreign_table_field' => 'parenttable'
140  ];
141  $propertyMetaData = [
142  'type' => \TYPO3\CMS\Extbase\Persistence\ObjectStorage::class,
143  'elementType' => 'Tx_Myext_Domain_Model_Foo'
144  ];
145  $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['setOneToOneRelation', 'setOneToManyRelation', 'setManyToManyRelation'], [], '', false);
146  $mockDataMapFactory->expects($this->never())->method('setOneToOneRelation');
147  $mockDataMapFactory->expects($this->once())->method('setOneToManyRelation')->will($this->returnValue($mockColumnMap));
148  $mockDataMapFactory->expects($this->never())->method('setManyToManyRelation');
149  $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $propertyMetaData);
150  }
151 
156  {
157  $mockColumnMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, [], [], '', false);
158  $columnConfiguration = [
159  'type' => 'select',
160  'foreign_table' => 'tx_myextension_bar',
161  'MM' => 'tx_myextension_mm'
162  ];
163  $propertyMetaData = [
164  'type' => \TYPO3\CMS\Extbase\Persistence\ObjectStorage::class,
165  'elementType' => 'Tx_Myext_Domain_Model_Foo'
166  ];
167  $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['setOneToOneRelation', 'setOneToManyRelation', 'setManyToManyRelation'], [], '', false);
168  $mockDataMapFactory->expects($this->never())->method('setOneToOneRelation');
169  $mockDataMapFactory->expects($this->never())->method('setOneToManyRelation');
170  $mockDataMapFactory->expects($this->once())->method('setManyToManyRelation')->will($this->returnValue($mockColumnMap));
171  $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $propertyMetaData);
172  }
173 
178  {
179  $mockColumnMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, [], [], '', false);
180  $columnConfiguration = [
181  'type' => 'inline',
182  'foreign_table' => 'tx_myextension_righttable',
183  'MM' => 'tx_myextension_mm'
184  ];
185  $propertyMetaData = [
186  'type' => \TYPO3\CMS\Extbase\Persistence\ObjectStorage::class,
187  'elementType' => 'Tx_Myext_Domain_Model_Foo'
188  ];
189  $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['setOneToOneRelation', 'setOneToManyRelation', 'setManyToManyRelation'], [], '', false);
190  $mockDataMapFactory->expects($this->never())->method('setOneToOneRelation');
191  $mockDataMapFactory->expects($this->never())->method('setOneToManyRelation');
192  $mockDataMapFactory->expects($this->once())->method('setManyToManyRelation')->will($this->returnValue($mockColumnMap));
193  $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $propertyMetaData);
194  }
195 
200  {
201  $leftColumnsDefinition = [
202  'rights' => [
203  'type' => 'select',
204  'foreign_table' => 'tx_myextension_righttable',
205  'foreign_table_where' => 'WHERE 1=1',
206  'MM' => 'tx_myextension_mm',
207  'MM_table_where' => 'WHERE 2=2'
208  ]
209  ];
210  $mockColumnMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, [], [], '', false);
211  $mockColumnMap->expects($this->once())->method('setTypeOfRelation')->with($this->equalTo(ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY));
212  $mockColumnMap->expects($this->once())->method('setRelationTableName')->with($this->equalTo('tx_myextension_mm'));
213  $mockColumnMap->expects($this->once())->method('setChildTableName')->with($this->equalTo('tx_myextension_righttable'));
214  $mockColumnMap->expects($this->once())->method('setChildTableWhereStatement')->with($this->equalTo('WHERE 1=1'));
215  $mockColumnMap->expects($this->once())->method('setChildSortByFieldName')->with($this->equalTo('sorting'));
216  $mockColumnMap->expects($this->once())->method('setParentKeyFieldName')->with($this->equalTo('uid_local'));
217  $mockColumnMap->expects($this->never())->method('setParentTableFieldName');
218  $mockColumnMap->expects($this->never())->method('setRelationTableMatchFields');
219  $mockColumnMap->expects($this->never())->method('setRelationTableInsertFields');
220  $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['dummy'], [], '', false);
221  $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
222  }
223 
228  {
229  $rightColumnsDefinition = [
230  'lefts' => [
231  'type' => 'select',
232  'foreign_table' => 'tx_myextension_lefttable',
233  'MM' => 'tx_myextension_mm',
234  'MM_opposite_field' => 'rights'
235  ]
236  ];
237  $leftColumnsDefinition['rights']['MM_opposite_field'] = 'opposite_field';
238  $mockColumnMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, [], [], '', false);
239  $mockColumnMap->expects($this->once())->method('setTypeOfRelation')->with($this->equalTo(ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY));
240  $mockColumnMap->expects($this->once())->method('setRelationTableName')->with($this->equalTo('tx_myextension_mm'));
241  $mockColumnMap->expects($this->once())->method('setChildTableName')->with($this->equalTo('tx_myextension_lefttable'));
242  $mockColumnMap->expects($this->once())->method('setChildTableWhereStatement')->with(null);
243  $mockColumnMap->expects($this->once())->method('setChildSortByFieldName')->with($this->equalTo('sorting_foreign'));
244  $mockColumnMap->expects($this->once())->method('setParentKeyFieldName')->with($this->equalTo('uid_foreign'));
245  $mockColumnMap->expects($this->never())->method('setParentTableFieldName');
246  $mockColumnMap->expects($this->never())->method('setRelationTableMatchFields');
247  $mockColumnMap->expects($this->never())->method('setRelationTableInsertFields');
248  $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['dummy'], [], '', false);
249  $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $rightColumnsDefinition['lefts']);
250  }
251 
256  {
257  $leftColumnsDefinition = [
258  'rights' => [
259  'type' => 'inline',
260  'foreign_table' => 'tx_myextension_righttable',
261  'MM' => 'tx_myextension_mm',
262  'foreign_sortby' => 'sorting'
263  ]
264  ];
265  $mockColumnMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, [], [], '', false);
266  $mockColumnMap->expects($this->once())->method('setTypeOfRelation')->with($this->equalTo(ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY));
267  $mockColumnMap->expects($this->once())->method('setRelationTableName')->with($this->equalTo('tx_myextension_mm'));
268  $mockColumnMap->expects($this->once())->method('setChildTableName')->with($this->equalTo('tx_myextension_righttable'));
269  $mockColumnMap->expects($this->once())->method('setChildTableWhereStatement');
270  $mockColumnMap->expects($this->once())->method('setChildSortByFieldName')->with($this->equalTo('sorting'));
271  $mockColumnMap->expects($this->once())->method('setParentKeyFieldName')->with($this->equalTo('uid_local'));
272  $mockColumnMap->expects($this->never())->method('setParentTableFieldName');
273  $mockColumnMap->expects($this->never())->method('setRelationTableMatchFields');
274  $mockColumnMap->expects($this->never())->method('setRelationTableInsertFields');
275  $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['getColumnsDefinition'], [], '', false);
276  $mockDataMapFactory->expects($this->never())->method('getColumnsDefinition');
277  $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
278  }
279 
284  {
285  $leftColumnsDefinition = [
286  'rights' => [
287  'type' => 'select',
288  'foreign_table' => 'tx_myextension_righttable',
289  'foreign_table_where' => 'WHERE 1=1',
290  'MM' => 'tx_myextension_mm'
291  ]
292  ];
293  $mockColumnMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, [], [], '', false);
294  $mockColumnMap->expects($this->once())->method('setRelationTableName')->with($this->equalTo('tx_myextension_mm'));
295  $mockColumnMap->expects($this->once())->method('getRelationTableName')->will($this->returnValue('tx_myextension_mm'));
296  $mockColumnMap->expects($this->never())->method('setrelationTablePageIdColumnName');
297  $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['getControlSection'], [], '', false);
298  $mockDataMapFactory->expects($this->once())->method('getControlSection')->with($this->equalTo('tx_myextension_mm'))->will($this->returnValue(null));
299  $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
300  }
301 
306  {
307  $leftColumnsDefinition = [
308  'rights' => [
309  'type' => 'select',
310  'foreign_table' => 'tx_myextension_righttable',
311  'foreign_table_where' => 'WHERE 1=1',
312  'MM' => 'tx_myextension_mm'
313  ]
314  ];
315  $mockColumnMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, [], [], '', false);
316  $mockColumnMap->expects($this->once())->method('setRelationTableName')->with($this->equalTo('tx_myextension_mm'));
317  $mockColumnMap->expects($this->once())->method('getRelationTableName')->will($this->returnValue('tx_myextension_mm'));
318  $mockColumnMap->expects($this->once())->method('setrelationTablePageIdColumnName')->with($this->equalTo('pid'));
319  $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['getControlSection'], [], '', false);
320  $mockDataMapFactory->expects($this->once())->method('getControlSection')->with($this->equalTo('tx_myextension_mm'))->will($this->returnValue(['ctrl' => ['foo' => 'bar']]));
321  $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
322  }
323 
328  {
329  return [
330  'date field' => ['date', 'date'],
331  'datetime field' => ['datetime', 'datetime'],
332  'no date/datetime field' => ['', null],
333  ];
334  }
335 
342  public function columnMapIsInitializedWithFieldEvaluationsForDateTimeFields($type, $expectedValue)
343  {
344  $columnDefinition = [
345  'type' => 'input',
346  'dbType' => $type,
347  'eval' => $type,
348  ];
349 
350  $mockColumnMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, ['setDateTimeStorageFormat'], [], '', false);
351 
352  if ($expectedValue !== null) {
353  $mockColumnMap->expects($this->once())->method('setDateTimeStorageFormat')->with($this->equalTo($type));
354  } else {
355  $mockColumnMap->expects($this->never())->method('setDateTimeStorageFormat');
356  }
357 
358  $accessibleClassName = $this->buildAccessibleProxy(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class);
359  $accessibleDataMapFactory = new $accessibleClassName();
360  $accessibleDataMapFactory->_callRef('setFieldEvaluations', $mockColumnMap, $columnDefinition);
361  }
362 
368  {
369  $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['getControlSection'], [], '', false);
370  $cacheMock = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, ['get'], [], '', false);
371  $cacheMock->expects($this->any())->method('get')->will($this->returnValue(false));
372  $mockDataMapFactory->_set('dataMapCache', $cacheMock);
373  $mockDataMapFactory->buildDataMap('UnknownObject');
374  }
375 
379  public function buildDataMapFetchesSubclassesRecursively()
380  {
381  $this->markTestSkipped('Incomplete mocking in a complex scenario. This should be a functional test');
382  $configuration = [
383  'persistence' => [
384  'classes' => [
385  \TYPO3\CMS\Extbase\Domain\Model\FrontendUser::class => [
386  'subclasses' => [
387  'Tx_SampleExt_Domain_Model_LevelOne1' => 'Tx_SampleExt_Domain_Model_LevelOne1',
388  'Tx_SampleExt_Domain_Model_LevelOne2' => 'Tx_SampleExt_Domain_Model_LevelOne2'
389  ]
390  ],
391  'Tx_SampleExt_Domain_Model_LevelOne1' => [
392  'subclasses' => [
393  'Tx_SampleExt_Domain_Model_LevelTwo1' => 'Tx_SampleExt_Domain_Model_LevelTwo1',
394  'Tx_SampleExt_Domain_Model_LevelTwo2' => 'Tx_SampleExt_Domain_Model_LevelTwo2'
395  ]
396  ],
397  'Tx_SampleExt_Domain_Model_LevelOne2' => [
398  'subclasses' => []
399  ]
400  ]
401  ]
402  ];
403  $expectedSubclasses = [
404  'Tx_SampleExt_Domain_Model_LevelOne1',
405  'Tx_SampleExt_Domain_Model_LevelTwo1',
406  'Tx_SampleExt_Domain_Model_LevelTwo2',
407  'Tx_SampleExt_Domain_Model_LevelOne2'
408  ];
409 
411  $objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManager::class, ['dummy'], [], '', false);
412 
414  $configurationManager = $this->getMock(\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::class);
415  $configurationManager->expects($this->once())->method('getConfiguration')->with('Framework')->will($this->returnValue($configuration));
417  $dataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['test']);
418  $dataMapFactory->_set('reflectionService', new \TYPO3\CMS\Extbase\Reflection\ReflectionService());
419  $dataMapFactory->_set('objectManager', $objectManager);
420  $dataMapFactory->_set('configurationManager', $configurationManager);
421  $cacheMock = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, [], [], '', false);
422  $cacheMock->expects($this->any())->method('get')->will($this->returnValue(false));
423  $dataMapFactory->_set('dataMapCache', $cacheMock);
424  $dataMap = $dataMapFactory->buildDataMap(\TYPO3\CMS\Extbase\Domain\Model\FrontendUser::class);
425  $this->assertSame($expectedSubclasses, $dataMap->getSubclasses());
426  }
427 
431  public function classNameTableNameMappings()
432  {
433  return [
434  'Core classes' => [\TYPO3\CMS\Belog\Domain\Model\LogEntry::class, 'tx_belog_domain_model_logentry'],
435  'Core classes with namespaces and leading backslash' => [\TYPO3\CMS\Belog\Domain\Model\LogEntry::class, 'tx_belog_domain_model_logentry'],
436  'Extension classes' => ['ExtbaseTeam\\BlogExample\\Domain\\Model\\Blog', 'tx_blogexample_domain_model_blog'],
437  'Extension classes with namespaces and leading backslash' => ['\\ExtbaseTeam\\BlogExample\\Domain\\Model\\Blog', 'tx_blogexample_domain_model_blog'],
438  'Extension classes without namespace' => ['Tx_News_Domain_Model_News', 'tx_news_domain_model_news'],
439  'Extension classes without namespace but leading slash' => ['\\Tx_News_Domain_Model_News', 'tx_news_domain_model_news'],
440  ];
441  }
442 
447  public function resolveTableNameReturnsExpectedTablenames($className, $expected)
448  {
449  $dataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['dummy']);
450  $this->assertSame($expected, $dataMapFactory->_call('resolveTableName', $className));
451  }
452 
456  public function createColumnMapReturnsAValidColumnMap()
457  {
459  $dataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['dummy']);
460 
462  $objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
463  $columnMap = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, [], ['column', 'property']);
464  $objectManager->expects($this->once())->method('get')->will($this->returnValue($columnMap));
465 
466  $dataMapFactory->_set('objectManager', $objectManager);
467 
468  $this->assertEquals(
469  $columnMap,
470  $dataMapFactory->_call('createColumnMap', 'column', 'property')
471  );
472  }
473 
478  {
479  return [
480  [['type' => 'input'], TableColumnType::INPUT, null],
481  [['type' => 'text'], TableColumnType::TEXT, null],
482  [['type' => 'check'], TableColumnType::CHECK, null],
483  [['type' => 'radio'], TableColumnType::RADIO, null],
484  [['type' => 'select'], TableColumnType::SELECT, null],
485  [['type' => 'group', 'internal_type' => 'db'], TableColumnType::GROUP, TableColumnSubType::DB],
486  [['type' => 'group', 'internal_type' => 'file'], TableColumnType::GROUP, TableColumnSubType::FILE],
487  [['type' => 'group', 'internal_type' => 'file_reference'], TableColumnType::GROUP, TableColumnSubType::FILE_REFERENCE],
488  [['type' => 'group', 'internal_type' => 'folder'], TableColumnType::GROUP, TableColumnSubType::FOLDER],
489  [['type' => 'none'], TableColumnType::NONE, null],
490  [['type' => 'passthrough'], TableColumnType::PASSTHROUGH, null],
491  [['type' => 'user'], TableColumnType::USER, null],
492  [['type' => 'flex'], TableColumnType::FLEX, null],
493  [['type' => 'inline'], TableColumnType::INLINE, null],
494  ];
495  }
496 
505  public function setTypeDetectsTypeAndInternalTypeProperly(array $columnConfiguration, $type, $internalType)
506  {
508  $dataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['dummy']);
509 
511  $columnMap = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::class, ['dummy'], [], '', false);
512 
513  $dataMapFactory->_call('setType', $columnMap, $columnConfiguration);
514 
515  $this->assertEquals($type, (string)$columnMap->getType());
516  $this->assertEquals($internalType, (string)$columnMap->getInternalType());
517  }
518 }
getAccessibleMock( $originalClassName, $methods=[], array $arguments=[], $mockClassName='', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true)