getAllowedDimensionPresetsAccordingToPreselection() публичный Метод

Returns a list of presets of the specified dimension which are allowed in combination with the given presets of other dimensions.
public getAllowedDimensionPresetsAccordingToPreselection ( string $dimensionName, array $preselectedDimensionPresets ) : array
$dimensionName string Name of the dimension to return presets for
$preselectedDimensionPresets array An array of dimension name and preset identifier specifying the presets which are already selected
Результат array An array of presets only for the dimension specified in $dimensionName. Structure is: array($dimensionName => array('presets' => array(...))
 /**
  * @test
  */
 public function getAllowedDimensionPresetsAccordingToPreselectionReturnsAllowedPresetsOfSecondDimensionIfPresetOfFirstDimensionIsGiven()
 {
     $source = new ConfigurationContentDimensionPresetSource();
     $configuration = $this->configurationWithThreeDimensionsAndManyValues;
     $configuration['country']['presets']['US']['constraints']['language']['*'] = false;
     $configuration['country']['presets']['US']['constraints']['language']['de'] = true;
     $configuration['country']['presets']['US']['constraints']['language']['en'] = true;
     $configuration['language']['presets']['it']['constraints']['country']['*'] = false;
     $configuration['language']['presets']['it']['constraints']['country']['IT'] = true;
     $source->setConfiguration($configuration);
     $dimensionAndPresets = $source->getAllowedDimensionPresetsAccordingToPreselection('language', array('country' => 'US'));
     # Only presets of the specified dimension should be returned:
     $this->assertTrue(isset($dimensionAndPresets['language']));
     $this->assertFalse(isset($dimensionAndPresets['country']));
     $this->assertFalse(isset($dimensionAndPresets['persona']));
     $dimensionAndPresets = $source->getAllowedDimensionPresetsAccordingToPreselection('language', array('country' => 'US'));
     # "de" and "en" are explicitly allowed for country "US":
     $this->assertArrayHasKey('de', $dimensionAndPresets['language']['presets']);
     $this->assertArrayHasKey('en', $dimensionAndPresets['language']['presets']);
     $this->assertcount(2, $dimensionAndPresets['language']['presets']);
     $dimensionAndPresets = $source->getAllowedDimensionPresetsAccordingToPreselection('country', array('language' => 'it'));
     # only "IT" is allowed as a country when "it" is selected as a language:
     $this->assertArrayHasKey('IT', $dimensionAndPresets['country']['presets']);
     $this->assertcount(1, $dimensionAndPresets['country']['presets']);
 }