‪TYPO3CMS  10.4
ClassesConfigurationFactoryTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
24 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
25 
29 class ‪ClassesConfigurationFactoryTest extends UnitTestCase
30 {
34  public function ‪inheritPropertiesFromParentClasses(): void
35  {
36  $classesConfigurationFactory = new ‪ClassesConfigurationFactory();
37 
38  $classes = [
39  A::class => [
40  'properties' => [
41  'propertiesFromA' => [
42  'fieldName' => 'field_name_a'
43  ]
44  ]
45  ],
46  B::class => [
47  'properties' => [
48  'propertiesFromA' => [
49  'fieldName' => 'field_name_z'
50  ],
51  'propertiesFromB' => [
52  'fieldName' => 'field_name_b'
53  ]
54  ]
55  ],
56  C::class => [
57  'properties' => [
58  'columnNameC' => [
59  'fieldName' => 'field_name_c'
60  ]
61  ]
62  ],
63  ];
64 
65  $reflectionMethod = (new \ReflectionClass($classesConfigurationFactory))
66  ->getMethod('inheritPropertiesFromParentClasses');
67  $reflectionMethod->setAccessible(true);
68  $classes = $reflectionMethod->invoke($classesConfigurationFactory, $classes);
69 
70  self::assertSame(
71  [
72  A::class => [
73  'properties' => [
74  'propertiesFromA' => [
75  'fieldName' => 'field_name_a'
76  ],
77  ]
78  ],
79  B::class => [
80  'properties' => [
81  'propertiesFromA' => [
82  'fieldName' => 'field_name_z'
83  ],
84  'propertiesFromB' => [
85  'fieldName' => 'field_name_b'
86  ],
87  ]
88  ],
89  C::class => [
90  'properties' => [
91  'propertiesFromA' => [
92  'fieldName' => 'field_name_z'
93  ],
94  'propertiesFromB' => [
95  'fieldName' => 'field_name_b'
96  ],
97  'columnNameC' => [
98  'fieldName' => 'field_name_c',
99  ],
100  ]
101  ],
102  ],
103  $classes
104  );
105  }
106 }
‪TYPO3\CMS\Extbase\Tests\Unit\Persistence\Fixture\Domain\Model\B
Definition: B.php:24
‪TYPO3\CMS\Extbase\Tests\Unit\Persistence\Fixture\Domain\Model\A
Definition: A.php:26
‪TYPO3\CMS\Extbase\Tests\Unit\Persistence
Definition: ClassesConfigurationFactoryTest.php:18
‪TYPO3\CMS\Extbase\Tests\Unit\Persistence\ClassesConfigurationFactoryTest\inheritPropertiesFromParentClasses
‪inheritPropertiesFromParentClasses()
Definition: ClassesConfigurationFactoryTest.php:34
‪TYPO3\CMS\Extbase\Tests\Unit\Persistence\ClassesConfigurationFactoryTest
Definition: ClassesConfigurationFactoryTest.php:30
‪TYPO3\CMS\Extbase\Persistence\ClassesConfigurationFactory
Definition: ClassesConfigurationFactory.php:37
‪TYPO3\CMS\Extbase\Tests\Unit\Persistence\Fixture\Domain\Model\C
Definition: C.php:24