[TASK] Resolve Todos in InheritancesResolverService
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Tests / Unit / Mvc / Configuration / InheritancesResolverServiceTest.php
index 0e7b332..208e37b 100644 (file)
@@ -14,14 +14,13 @@ namespace TYPO3\CMS\Form\Tests\Unit\Mvc\Configuration;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Core\Tests\UnitTestCase;
 use TYPO3\CMS\Form\Mvc\Configuration\Exception\CycleInheritancesException;
 use TYPO3\CMS\Form\Mvc\Configuration\InheritancesResolverService;
 
 /**
  * Test case
  */
-class InheritancesResolverServiceTest extends UnitTestCase
+class InheritancesResolverServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 {
     /**
      * @var InheritancesResolverService
@@ -33,6 +32,46 @@ class InheritancesResolverServiceTest extends UnitTestCase
         $this->subject = new InheritancesResolverService();
     }
 
+    /**
+     * @test
+     * Test for the explicit example in service class comment
+     */
+    public function getDocExampleInheritance()
+    {
+        $input = [
+            'Form' => [
+                'part1' => [
+                    'key1' => 'value1',
+                    'key2' => 'value2',
+                    'key3' => 'value3',
+                ],
+                'part2' => [
+                    '__inheritances' => [
+                        10 => 'Form.part1',
+                    ],
+                    'key2' => 'another_value'
+                ],
+            ],
+        ];
+
+        $expected = [
+            'Form' => [
+                'part1' => [
+                    'key1' => 'value1',
+                    'key2' => 'value2',
+                    'key3' => 'value3',
+                ],
+                'part2' => [
+                    'key1' => 'value1',
+                    'key2' => 'another_value',
+                    'key3' => 'value3'
+                ],
+            ],
+        ];
+
+        $this->assertSame($expected, $this->subject->reset()->setReferenceConfiguration($input)->getResolvedConfiguration($input));
+    }
+
     /**
      * @test
      */