/** * @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 */ public function convertRawConfigurationToArrayReturnsSortedHierarchicArray() { $configRaw = '# cat=basic/enable/10; type=string; label=Item 1: This is the first configuration item item1 = one # cat=basic/enable/20; type=int+; label=Integer Value: Please insert a positive integer value integerValue = 1 # cat=advanced/file/10; type=boolean; label=enableJquery: Insert jQuery plugin enableJquery = 1'; $extension = array(); $expectedArray = array('basic' => array('enable' => array('item1' => array('cat' => 'basic', 'subcat_name' => 'enable', 'subcat' => 'a/enable/10z', 'type' => 'string', 'label' => 'Item 1: This is the first configuration item', 'name' => 'item1', 'value' => 'one', 'default_value' => 'one', 'labels' => array(0 => 'Item 1', 1 => 'This is the first configuration item')), 'integerValue' => array('cat' => 'basic', 'subcat_name' => 'enable', 'subcat' => 'a/enable/20z', 'type' => 'int+', 'label' => 'Integer Value: Please insert a positive integer value', 'name' => 'integerValue', 'value' => '1', 'default_value' => '1', 'labels' => array(0 => 'Integer Value', 1 => 'Please insert a positive integer value')))), 'advanced' => array('file' => array('enableJquery' => array('cat' => 'advanced', 'subcat_name' => 'file', 'subcat' => 'c/file/10z', 'type' => 'boolean', 'label' => 'enableJquery: Insert jQuery plugin', 'name' => 'enableJquery', 'value' => '1', 'default_value' => '1', 'labels' => array(0 => 'enableJquery', 1 => 'Insert jQuery plugin'))))); $this->assertSame($expectedArray, $this->configurationItemRepository->_callRef('convertRawConfigurationToArray', $configRaw, $extension)); }