public function testGetInfoFromConfiguration() { $config_path = __DIR__ . '/../sphinx/conf/valid.example.conf'; $plain_config = file_get_contents($config_path); $config = Configuration::fromString($plain_config, eVersion::V_2_2_10()); foreach ($config->iterateIndex() as $section) { foreach ($section->iterateOptions() as $option) { $option->getInfo(); } } foreach ($config->iterateSource() as $section) { foreach ($section->iterateOptions() as $option) { $option->getInfo(); } } if ($config->isHasIndexer()) { foreach ($config->getIndexer()->iterateOptions() as $option) { $option->getInfo(); } } if ($config->isHasSearchd()) { foreach ($config->getSearchd()->iterateOptions() as $option) { $option->getInfo(); } } if ($config->isHasCommon()) { foreach ($config->getCommon()->iterateOptions() as $option) { $option->getInfo(); } } }
/** * parse and prepare info from docks * * @throws \InvalidArgumentException * @throws \LogicException * @throws \Symfony\Component\Yaml\Exception\ParseException */ private function prepareDocumentation() { foreach (eVersion::getConstants() as $cons => $version) { $eVersion = eVersion::get($version); $documentation = $this->getDocumentation($eVersion); $this->processDocumentation($documentation); } $this->removeDuplicates(); }
/** * @param eSection $section * @param eVersion $targetVersion * @param array $versions * * @return array * @throws \Symfony\Component\Yaml\Exception\ParseException * @throws \LogicException * @throws \LTDBeget\sphinx\informer\exceptions\InformerRuntimeException * @throws \LTDBeget\sphinx\informer\exceptions\DocumentationSourceException * @throws \InvalidArgumentException */ private function getPermanentlyRemoved(eSection $section, eVersion $targetVersion, array $versions) : array { $target_version_options = $this->getVersionOptions($section, $targetVersion); $old_versions_options = []; foreach ($versions as $version) { /** @noinspection SlowArrayOperationsInLoopInspection */ $old_versions_options = array_merge($this->getVersionOptions($section, eVersion::get($version)), $old_versions_options); } $old_versions_options = array_unique($old_versions_options); $options_intersect = array_intersect($target_version_options, $old_versions_options); $values = array_flip(array_values(array_diff($old_versions_options, $options_intersect))); array_walk($values, function (&$value) { $value = true; }); return $values; }
public function testOnRemoveParentRemoveChild() { $configuration = new Configuration(eVersion::V_2_2_10()); $parent_name = 'source1'; $child_name = 'source2'; $parent = $configuration->addSource($parent_name); $child = $configuration->addSource($child_name, $parent_name); $parent->delete(); static::assertTrue($child->isDeleted()); }