TYPO3 CMS  TYPO3_7-6
ClassInfoFactoryTest.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 {
25  protected $classInfoFactory;
26 
30  protected function setUp()
31  {
32  $this->classInfoFactory = new \TYPO3\CMS\Extbase\Object\Container\ClassInfoFactory();
33  }
34 
40  {
41  $this->classInfoFactory->buildClassInfoFromClassName('SomeNonExistingClass');
42  }
43 
48  {
49  $classInfo = $this->classInfoFactory->buildClassInfoFromClassName('t3lib_object_tests_class_with_injectsettings');
50  $this->assertEquals(['injectFoo' => 't3lib_object_tests_resolveablecyclic1'], $classInfo->getInjectMethods());
51  }
52 
57  {
58  $classInfo = $this->classInfoFactory->buildClassInfoFromClassName(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithInjectProperties::class);
59  $this->assertEquals(['secondDummyClass' => \TYPO3\CMS\Extbase\Tests\Fixture\SecondDummyClass::class], $classInfo->getInjectProperties());
60  }
61 
65  public function buildClassInfoReturnsCustomClassInfoForDateTime()
66  {
67 
69  $classInfoFactory = $this->getMock(\TYPO3\CMS\Extbase\Object\Container\ClassInfoFactory::class, ['dummy']);
70  $classInfoFactory->expects($this->never())->method('getConstructorArguments');
71 
72  $classInfo = $classInfoFactory->buildClassInfoFromClassName('DateTime');
73  $this->assertEquals(
74  new \TYPO3\CMS\Extbase\Object\Container\ClassInfo('DateTime', [], [], false, false, []),
75  $classInfo
76  );
77  }
78 }