TYPO3 CMS  TYPO3_6-2
DataMapFactoryTest.php
Go to the documentation of this file.
1 <?php
20 
25 
29  public function oneToOneRelation() {
30  return array(
31  array('Tx_Myext_Domain_Model_Foo'),
32  array('TYPO3\\CMS\\Extbase\\Domain\\Model\\FrontendUser')
33  );
34  }
35 
40  public function setRelationsDetectsOneToOneRelation($className) {
41  $mockColumnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array(), array(), '', FALSE);
42  $columnConfiguration = array(
43  'type' => 'select',
44  'foreign_table' => 'tx_myextension_bar',
45  'foreign_field' => 'parentid'
46  );
47  $propertyMetaData = array(
48  'type' => $className,
49  'elementType' => NULL
50  );
51  $mockDataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('setOneToOneRelation', 'setOneToManyRelation', 'setManyToManyRelation'), array(), '', FALSE);
52  $mockDataMapFactory->expects($this->once())->method('setOneToOneRelation')->will($this->returnValue($mockColumnMap));
53  $mockDataMapFactory->expects($this->never())->method('setOneToManyRelation');
54  $mockDataMapFactory->expects($this->never())->method('setManyToManyRelation');
55  $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $propertyMetaData);
56  }
57 
62  $mockColumnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array(), array(), '', FALSE);
63  $matchFields = array(
64  'fieldname' => 'foo_model'
65  );
66  $columnConfiguration = array(
67  'type' => 'select',
68  'foreign_table' => 'tx_myextension_bar',
69  'foreign_field' => 'parentid',
70  'foreign_match_fields' => $matchFields
71  );
72 
73  $mockColumnMap->expects($this->once())
74  ->method('setRelationTableMatchFields')
75  ->with($matchFields);
76  $mockDataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('dummy'), array(), '', FALSE);
77  $mockDataMapFactory->_call('setOneToOneRelation', $mockColumnMap, $columnConfiguration);
78  }
79 
84  $mockColumnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array(), array(), '', FALSE);
85  $matchFields = array(
86  'fieldname' => 'foo_model'
87  );
88  $columnConfiguration = array(
89  'type' => 'select',
90  'foreign_table' => 'tx_myextension_bar',
91  'foreign_field' => 'parentid',
92  'foreign_match_fields' => $matchFields
93  );
94 
95  $mockColumnMap->expects($this->once())
96  ->method('setRelationTableMatchFields')
97  ->with($matchFields);
98  $mockDataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('dummy'), array(), '', FALSE);
99  $mockDataMapFactory->_call('setOneToManyRelation', $mockColumnMap, $columnConfiguration);
100  }
101 
106  $mockColumnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array(), array(), '', FALSE);
107  $columnConfiguration = array(
108  'type' => 'select',
109  'foreign_table' => 'tx_myextension_bar',
110  'MM' => 'tx_myextension_mm'
111  );
112  $propertyMetaData = array(
113  'type' => 'Tx_Myext_Domain_Model_Foo',
114  'elementType' => NULL
115  );
116  $mockDataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('setOneToOneRelation', 'setOneToManyRelation', 'setManyToManyRelation'), array(), '', FALSE);
117  $mockDataMapFactory->expects($this->never())->method('setOneToOneRelation');
118  $mockDataMapFactory->expects($this->never())->method('setOneToManyRelation');
119  $mockDataMapFactory->expects($this->once())->method('setManyToManyRelation')->will($this->returnValue($mockColumnMap));
120  $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $propertyMetaData);
121  }
122 
127  $mockColumnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array(), array(), '', FALSE);
128  $columnConfiguration = array(
129  'type' => 'select',
130  'foreign_table' => 'tx_myextension_bar',
131  'foreign_field' => 'parentid',
132  'foreign_table_field' => 'parenttable'
133  );
134  $propertyMetaData = array(
135  'type' => 'TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage',
136  'elementType' => 'Tx_Myext_Domain_Model_Foo'
137  );
138  $mockDataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('setOneToOneRelation', 'setOneToManyRelation', 'setManyToManyRelation'), array(), '', FALSE);
139  $mockDataMapFactory->expects($this->never())->method('setOneToOneRelation');
140  $mockDataMapFactory->expects($this->once())->method('setOneToManyRelation')->will($this->returnValue($mockColumnMap));
141  $mockDataMapFactory->expects($this->never())->method('setManyToManyRelation');
142  $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $propertyMetaData);
143  }
144 
149  $mockColumnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array(), array(), '', FALSE);
150  $columnConfiguration = array(
151  'type' => 'select',
152  'foreign_table' => 'tx_myextension_bar',
153  'MM' => 'tx_myextension_mm'
154  );
155  $propertyMetaData = array(
156  'type' => 'TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage',
157  'elementType' => 'Tx_Myext_Domain_Model_Foo'
158  );
159  $mockDataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('setOneToOneRelation', 'setOneToManyRelation', 'setManyToManyRelation'), array(), '', FALSE);
160  $mockDataMapFactory->expects($this->never())->method('setOneToOneRelation');
161  $mockDataMapFactory->expects($this->never())->method('setOneToManyRelation');
162  $mockDataMapFactory->expects($this->once())->method('setManyToManyRelation')->will($this->returnValue($mockColumnMap));
163  $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $propertyMetaData);
164  }
165 
170  $mockColumnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array(), array(), '', FALSE);
171  $columnConfiguration = array(
172  'type' => 'inline',
173  'foreign_table' => 'tx_myextension_righttable',
174  'MM' => 'tx_myextension_mm'
175  );
176  $propertyMetaData = array(
177  'type' => 'TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage',
178  'elementType' => 'Tx_Myext_Domain_Model_Foo'
179  );
180  $mockDataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('setOneToOneRelation', 'setOneToManyRelation', 'setManyToManyRelation'), array(), '', FALSE);
181  $mockDataMapFactory->expects($this->never())->method('setOneToOneRelation');
182  $mockDataMapFactory->expects($this->never())->method('setOneToManyRelation');
183  $mockDataMapFactory->expects($this->once())->method('setManyToManyRelation')->will($this->returnValue($mockColumnMap));
184  $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $propertyMetaData);
185  }
186 
191  $leftColumnsDefinition = array(
192  'rights' => array(
193  'type' => 'select',
194  'foreign_table' => 'tx_myextension_righttable',
195  'foreign_table_where' => 'WHERE 1=1',
196  'MM' => 'tx_myextension_mm',
197  'MM_table_where' => 'WHERE 2=2'
198  )
199  );
200  $mockColumnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array(), array(), '', FALSE);
201  $mockColumnMap->expects($this->once())->method('setTypeOfRelation')->with($this->equalTo(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY));
202  $mockColumnMap->expects($this->once())->method('setRelationTableName')->with($this->equalTo('tx_myextension_mm'));
203  $mockColumnMap->expects($this->once())->method('setChildTableName')->with($this->equalTo('tx_myextension_righttable'));
204  $mockColumnMap->expects($this->once())->method('setChildTableWhereStatement')->with($this->equalTo('WHERE 1=1'));
205  $mockColumnMap->expects($this->once())->method('setChildSortByFieldName')->with($this->equalTo('sorting'));
206  $mockColumnMap->expects($this->once())->method('setParentKeyFieldName')->with($this->equalTo('uid_local'));
207  $mockColumnMap->expects($this->never())->method('setParentTableFieldName');
208  $mockColumnMap->expects($this->never())->method('setRelationTableMatchFields');
209  $mockColumnMap->expects($this->never())->method('setRelationTableInsertFields');
210  $mockDataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('dummy'), array(), '', FALSE);
211  $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
212  }
213 
218  $rightColumnsDefinition = array(
219  'lefts' => array(
220  'type' => 'select',
221  'foreign_table' => 'tx_myextension_lefttable',
222  'MM' => 'tx_myextension_mm',
223  'MM_opposite_field' => 'rights'
224  )
225  );
226  $leftColumnsDefinition['rights']['MM_opposite_field'] = 'opposite_field';
227  $mockColumnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array(), array(), '', FALSE);
228  $mockColumnMap->expects($this->once())->method('setTypeOfRelation')->with($this->equalTo(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY));
229  $mockColumnMap->expects($this->once())->method('setRelationTableName')->with($this->equalTo('tx_myextension_mm'));
230  $mockColumnMap->expects($this->once())->method('setChildTableName')->with($this->equalTo('tx_myextension_lefttable'));
231  $mockColumnMap->expects($this->once())->method('setChildTableWhereStatement')->with(NULL);
232  $mockColumnMap->expects($this->once())->method('setChildSortByFieldName')->with($this->equalTo('sorting_foreign'));
233  $mockColumnMap->expects($this->once())->method('setParentKeyFieldName')->with($this->equalTo('uid_foreign'));
234  $mockColumnMap->expects($this->never())->method('setParentTableFieldName');
235  $mockColumnMap->expects($this->never())->method('setRelationTableMatchFields');
236  $mockColumnMap->expects($this->never())->method('setRelationTableInsertFields');
237  $mockDataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('dummy'), array(), '', FALSE);
238  $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $rightColumnsDefinition['lefts']);
239  }
240 
245  $leftColumnsDefinition = array(
246  'rights' => array(
247  'type' => 'inline',
248  'foreign_table' => 'tx_myextension_righttable',
249  'MM' => 'tx_myextension_mm',
250  'foreign_sortby' => 'sorting'
251  )
252  );
253  $mockColumnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array(), array(), '', FALSE);
254  $mockColumnMap->expects($this->once())->method('setTypeOfRelation')->with($this->equalTo(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY));
255  $mockColumnMap->expects($this->once())->method('setRelationTableName')->with($this->equalTo('tx_myextension_mm'));
256  $mockColumnMap->expects($this->once())->method('setChildTableName')->with($this->equalTo('tx_myextension_righttable'));
257  $mockColumnMap->expects($this->once())->method('setChildTableWhereStatement');
258  $mockColumnMap->expects($this->once())->method('setChildSortByFieldName')->with($this->equalTo('sorting'));
259  $mockColumnMap->expects($this->once())->method('setParentKeyFieldName')->with($this->equalTo('uid_local'));
260  $mockColumnMap->expects($this->never())->method('setParentTableFieldName');
261  $mockColumnMap->expects($this->never())->method('setRelationTableMatchFields');
262  $mockColumnMap->expects($this->never())->method('setRelationTableInsertFields');
263  $mockDataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('getColumnsDefinition'), array(), '', FALSE);
264  $mockDataMapFactory->expects($this->never())->method('getColumnsDefinition');
265  $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
266  }
267 
272  $leftColumnsDefinition = array(
273  'rights' => array(
274  'type' => 'select',
275  'foreign_table' => 'tx_myextension_righttable',
276  'foreign_table_where' => 'WHERE 1=1',
277  'MM' => 'tx_myextension_mm'
278  )
279  );
280  $mockColumnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array(), array(), '', FALSE);
281  $mockColumnMap->expects($this->once())->method('setRelationTableName')->with($this->equalTo('tx_myextension_mm'));
282  $mockColumnMap->expects($this->once())->method('getRelationTableName')->will($this->returnValue('tx_myextension_mm'));
283  $mockColumnMap->expects($this->never())->method('setrelationTablePageIdColumnName');
284  $mockDataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('getControlSection'), array(), '', FALSE);
285  $mockDataMapFactory->expects($this->once())->method('getControlSection')->with($this->equalTo('tx_myextension_mm'))->will($this->returnValue(NULL));
286  $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
287  }
288 
293  $leftColumnsDefinition = array(
294  'rights' => array(
295  'type' => 'select',
296  'foreign_table' => 'tx_myextension_righttable',
297  'foreign_table_where' => 'WHERE 1=1',
298  'MM' => 'tx_myextension_mm'
299  )
300  );
301  $mockColumnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array(), array(), '', FALSE);
302  $mockColumnMap->expects($this->once())->method('setRelationTableName')->with($this->equalTo('tx_myextension_mm'));
303  $mockColumnMap->expects($this->once())->method('getRelationTableName')->will($this->returnValue('tx_myextension_mm'));
304  $mockColumnMap->expects($this->once())->method('setrelationTablePageIdColumnName')->with($this->equalTo('pid'));
305  $mockDataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('getControlSection'), array(), '', FALSE);
306  $mockDataMapFactory->expects($this->once())->method('getControlSection')->with($this->equalTo('tx_myextension_mm'))->will($this->returnValue(array('ctrl' => array('foo' => 'bar'))));
307  $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
308  }
309 
314  return array(
315  'date field' => array('date', 'date'),
316  'datetime field' => array('datetime', 'datetime'),
317  'no date/datetime field' => array('', NULL),
318  );
319  }
320 
327  public function columnMapIsInitializedWithFieldEvaluationsForDateTimeFields($type, $expectedValue) {
328  $columnDefinition = array(
329  'type' => 'input',
330  'dbType' => $type,
331  'eval' => $type,
332  );
333 
334  $mockColumnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array('setDateTimeStorageFormat'), array(), '', FALSE);
335 
336  if ($expectedValue !== NULL) {
337  $mockColumnMap->expects($this->once())->method('setDateTimeStorageFormat')->with($this->equalTo($type));
338  } else {
339  $mockColumnMap->expects($this->never())->method('setDateTimeStorageFormat');
340  }
341 
342  $accessibleClassName = $this->buildAccessibleProxy('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory');
343  $accessibleDataMapFactory = new $accessibleClassName();
344  $accessibleDataMapFactory->_callRef('setFieldEvaluations', $mockColumnMap, $columnDefinition);
345  }
346 
352  $mockDataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('getControlSection'), array(), '', FALSE);
353  $cacheMock = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\VariableFrontend', array('get'), array(), '', FALSE);
354  $cacheMock->expects($this->any())->method('get')->will($this->returnValue(FALSE));
355  $mockDataMapFactory->_set('dataMapCache', $cacheMock);
356  $mockDataMapFactory->buildDataMap('UnknownObject');
357  }
358 
362  public function buildDataMapFetchesSubclassesRecursively() {
363  $this->markTestSkipped('Incomplete mocking in a complex scenario. This should be a functional test');
364  $configuration = array(
365  'persistence' => array(
366  'classes' => array(
367  'TYPO3\\CMS\\Extbase\\Domain\\Model\\FrontendUser' => array(
368  'subclasses' => array(
369  'Tx_SampleExt_Domain_Model_LevelOne1' => 'Tx_SampleExt_Domain_Model_LevelOne1',
370  'Tx_SampleExt_Domain_Model_LevelOne2' => 'Tx_SampleExt_Domain_Model_LevelOne2'
371  )
372  ),
373  'Tx_SampleExt_Domain_Model_LevelOne1' => array(
374  'subclasses' => array(
375  'Tx_SampleExt_Domain_Model_LevelTwo1' => 'Tx_SampleExt_Domain_Model_LevelTwo1',
376  'Tx_SampleExt_Domain_Model_LevelTwo2' => 'Tx_SampleExt_Domain_Model_LevelTwo2'
377  )
378  ),
379  'Tx_SampleExt_Domain_Model_LevelOne2' => array(
380  'subclasses' => array()
381  )
382  )
383  )
384  );
385  $expectedSubclasses = array(
386  'Tx_SampleExt_Domain_Model_LevelOne1',
387  'Tx_SampleExt_Domain_Model_LevelTwo1',
388  'Tx_SampleExt_Domain_Model_LevelTwo2',
389  'Tx_SampleExt_Domain_Model_LevelOne2'
390  );
391 
393  $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', array('dummy'), array(), '', FALSE);
394 
396  $configurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
397  $configurationManager->expects($this->once())->method('getConfiguration')->with('Framework')->will($this->returnValue($configuration));
399  $dataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('test'));
400  $dataMapFactory->_set('reflectionService', new \TYPO3\CMS\Extbase\Reflection\ReflectionService());
401  $dataMapFactory->_set('objectManager', $objectManager);
402  $dataMapFactory->_set('configurationManager', $configurationManager);
403  $cacheMock = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\VariableFrontend', array(), array(), '', FALSE);
404  $cacheMock->expects($this->any())->method('get')->will($this->returnValue(FALSE));
405  $dataMapFactory->_set('dataMapCache', $cacheMock);
406  $dataMap = $dataMapFactory->buildDataMap('TYPO3\\CMS\\Extbase\\Domain\\Model\\FrontendUser');
407  $this->assertSame($expectedSubclasses, $dataMap->getSubclasses());
408  }
409 
413  public function classNameTableNameMappings() {
414  return array(
415  'Core classes' => array('TYPO3\\CMS\\Belog\\Domain\\Model\\LogEntry', 'tx_belog_domain_model_logentry'),
416  'Core classes with namespaces and leading backslash' => array('\\TYPO3\\CMS\\Belog\\Domain\\Model\\LogEntry', 'tx_belog_domain_model_logentry'),
417  'Extension classes' => array('ExtbaseTeam\\BlogExample\\Domain\\Model\\Blog', 'tx_blogexample_domain_model_blog'),
418  'Extension classes with namespaces and leading backslash' => array('\\ExtbaseTeam\\BlogExample\\Domain\\Model\\Blog', 'tx_blogexample_domain_model_blog'),
419  'Extension classes without namespace' => array('Tx_News_Domain_Model_News', 'tx_news_domain_model_news'),
420  'Extension classes without namespace but leading slash' => array('\\Tx_News_Domain_Model_News', 'tx_news_domain_model_news'),
421  );
422  }
423 
428  public function resolveTableNameReturnsExpectedTablenames($className, $expected) {
429  $dataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('dummy'));
430  $this->assertSame($expected, $dataMapFactory->_call('resolveTableName', $className));
431  }
432 
436  public function createColumnMapReturnsAValidColumnMap() {
438  $dataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('dummy'));
439 
441  $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
442  $columnMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\ColumnMap', array(), array('column', 'property'));
443  $objectManager->expects($this->once())->method('get')->will($this->returnValue($columnMap));
444 
445  $dataMapFactory->_set('objectManager', $objectManager);
446 
447  $this->assertEquals(
448  $columnMap,
449  $dataMapFactory->_call('createColumnMap', 'column', 'property')
450  );
451  }
452 
457  return array(
458  array(array('type' => 'input'), TableColumnType::INPUT, NULL),
459  array(array('type' => 'text'), TableColumnType::TEXT, NULL),
460  array(array('type' => 'check'), TableColumnType::CHECK, NULL),
461  array(array('type' => 'radio'), TableColumnType::RADIO, NULL),
462  array(array('type' => 'select'), TableColumnType::SELECT, NULL),
463  array(array('type' => 'group', 'internal_type' => 'db'), TableColumnType::GROUP, TableColumnSubType::DB),
464  array(array('type' => 'group', 'internal_type' => 'file'), TableColumnType::GROUP, TableColumnSubType::FILE),
465  array(array('type' => 'group', 'internal_type' => 'file_reference'), TableColumnType::GROUP, TableColumnSubType::FILE_REFERENCE),
466  array(array('type' => 'group', 'internal_type' => 'folder'), TableColumnType::GROUP, TableColumnSubType::FOLDER),
467  array(array('type' => 'none'), TableColumnType::NONE, NULL),
468  array(array('type' => 'passthrough'), TableColumnType::PASSTHROUGH, NULL),
469  array(array('type' => 'user'), TableColumnType::USER, NULL),
470  array(array('type' => 'flex'), TableColumnType::FLEX, NULL),
471  array(array('type' => 'inline'), TableColumnType::INLINE, NULL),
472  );
473  }
474 
483  public function setTypeDetectsTypeAndInternalTypeProperly(array $columnConfiguration, $type, $internalType) {
485  $dataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('dummy'));
486 
488  $columnMap = $this->getAccessibleMock('TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap', array('dummy'), array(), '', FALSE);
489 
490  $dataMapFactory->_call('setType', $columnMap, $columnConfiguration);
491 
492  $this->assertEquals($type, (string) $columnMap->getType());
493  $this->assertEquals($internalType, (string) $columnMap->getInternalType());
494  }
495 }
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)