[BUGFIX] EM 6.0 parse configuration type 'options' correctly
[Packages/TYPO3.CMS.git] / typo3 / sysext / extensionmanager / Tests / Unit / Domain / Repository / ConfigurationItemRepositoryTest.php
index e7bb3e1..6aaff0c 100644 (file)
@@ -176,6 +176,36 @@ class ConfigurationItemRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\Base
                $this->assertEquals($option['typeComparisonValue'], $optionModified['type']);
        }
 
+       /**
+        *
+        * @test
+        * @return void
+        */
+       public function extractInformationForConfigFieldsOfTypeOptionsWithLabelsAndValuesAddsGenericTypeAndLabelInformation() {
+               $option = array(
+                       'cat' => 'basic',
+                       'subcat_name' => 'enable',
+                       'subcat' => 'a/enable/100z',
+                       'type' => 'options[Minimal (Most features disabled. Administrator needs to enable them using TypoScript. For advanced administrators only.)=MINIMAL,Typical (Most commonly used features are enabled. Select this option if you are unsure which one to use.) = TYPICAL,Demo (Show-off configuration. Includes pre-configured styles. Not for production environments.)=DEMO]',
+                       'label' => 'Default configuration settings',
+                       'name' => 'defaultConfiguration',
+                       'value' => 'Typical (Most commonly used features are enabled. Select this option if you are unsure which one to use.)',
+                       'default_value' => 'Typical (Most commonly used features are enabled. Select this option if you are unsure which one to use.)',
+                       'genericComparisonValue' => array(
+                               'Minimal (Most features disabled. Administrator needs to enable them using TypoScript. For advanced administrators only.)' => 'MINIMAL',
+                               'Typical (Most commonly used features are enabled. Select this option if you are unsure which one to use.)' => 'TYPICAL',
+                               'Demo (Show-off configuration. Includes pre-configured styles. Not for production environments.)' => 'DEMO'
+                       ),
+                       'typeComparisonValue' => 'options'
+               );
+               $optionModified = $this->configurationItemRepository->_callRef('extractInformationForConfigFieldsOfTypeOptions', $option);
+               $this->assertArrayHasKey('generic', $optionModified);
+               $this->assertArrayHasKey('type', $optionModified);
+               $this->assertArrayHasKey('label', $optionModified);
+               $this->assertEquals($option['genericComparisonValue'], $optionModified['generic']);
+               $this->assertEquals($option['typeComparisonValue'], $optionModified['type']);
+       }
+
        /**
         *
         * @test