/** * Returns a list of auto-detected config items for a feature. * * @param string $name * Short machine name of feature to process. * * @return array * List of auto-detected config items, keyed by type and short name. */ public function detect($name) { $detected = array(); $this->assigner->assignConfigPackages(); $config_collection = $this->featuresManager->getConfigCollection(); $items = $_POST['items']; if (!empty($items)) { $excluded = !empty($_POST['excluded']) ? $_POST['excluded'] : array(); $selected = array(); foreach ($items as $key) { preg_match('/^([^\\[]+)(\\[.+\\])?\\[(.+)\\]\\[(.+)\\]$/', $key, $matches); if (!empty($matches[1]) && !empty($matches[4])) { $component = $matches[1]; $item = $this->domDecode($matches[4]); if (!isset($excluded[$component][$item])) { $selected[] = $this->featuresManager->getFullName($component, $item); } } } $detected = !empty($selected) ? $this->getConfigDependents($selected) : array(); $detected = array_merge($detected, $selected); } $result = []; foreach ($detected as $name) { $item = $config_collection[$name]; $result[$item->getType()][$item->getShortName()] = $item->getName(); } return new JsonResponse($result); }
/** * @covers ::getFullName * @dataProvider providerTestGetFullName */ public function testGetFullName($type, $name, $expected) { $this->assertEquals($this->featuresManager->getFullName($type, $name), $expected); }