Neos\ContentRepository\Tests\Unit\Domain\Service\ConfigurationContentDimensionPresetSourceTest::getAllowedDimensionPresetsAccordingToPreselectionReturnsAllowedPresetsOfSecondDimensionIfPresetOfFirstDimensionIsGiven PHP Method

getAllowedDimensionPresetsAccordingToPreselectionReturnsAllowedPresetsOfSecondDimensionIfPresetOfFirstDimensionIsGiven() public method

    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']);
    }