TYPO3 CMS  TYPO3_6-2
ClassInfoFactoryTest.php
Go to the documentation of this file.
1 <?php
3 
17 require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('extbase') . 'Tests/Unit/Object/Container/Fixtures/Testclasses.php';
18 
23 
27  protected $classInfoFactory;
28 
32  public function setUp() {
33  $this->classInfoFactory = new \TYPO3\CMS\Extbase\Object\Container\ClassInfoFactory();
34  }
35 
41  $this->classInfoFactory->buildClassInfoFromClassName('SomeNonExistingClass');
42  }
43 
48  $classInfo = $this->classInfoFactory->buildClassInfoFromClassName('t3lib_object_tests_class_with_injectsettings');
49  $this->assertEquals(array('injectFoo' => 't3lib_object_tests_resolveablecyclic1'), $classInfo->getInjectMethods());
50  }
51 
56  $classInfo = $this->classInfoFactory->buildClassInfoFromClassName('TYPO3\\CMS\\Extbase\\Tests\\Fixture\\ClassWithInjectProperties');
57  $this->assertEquals(array('secondDummyClass' => 'TYPO3\\CMS\\Extbase\\Tests\\Fixture\\SecondDummyClass'), $classInfo->getInjectProperties());
58  }
59 
63  public function buildClassInfoReturnsCustomClassInfoForDateTime() {
64 
66  $classInfoFactory = $this->getMock('TYPO3\CMS\Extbase\Object\Container\ClassInfoFactory', array('dummy'));
67  $classInfoFactory->expects($this->never())->method('getConstructorArguments');
68 
69  $classInfo = $classInfoFactory->buildClassInfoFromClassName('DateTime');
70  $this->assertEquals(
71  new \TYPO3\CMS\Extbase\Object\Container\ClassInfo('DateTime', array(), array(), FALSE, FALSE, array()),
72  $classInfo
73  );
74  }
75 }