public function testSavingComplexStructure() { $config = new IniConfiguration(); $values = new IniConfiguration(); $values->setValue('ValueOne', 'foo'); $values->setValue('ValueTwo', 'bar'); $subSection = new IniConfiguration(); $subSection->setSection('SubSection', $values); $config->setSection('Section', $subSection); ConfigurationManager::saveConfiguration(self::TEST_VENDOR, null, null, self::TEST_ENVIRONMENT, self::TEST_NEW_CONFIG_NAME, $config); $storedConfig = ConfigurationManager::loadConfiguration(self::TEST_VENDOR, null, null, self::TEST_ENVIRONMENT, self::TEST_NEW_CONFIG_NAME); $this->assertEquals($config->getSection('Section')->getSection('SubSection')->getValue('ValueOne'), $storedConfig->getSection('Section')->getSection('SubSection')->getValue('ValueOne')); $this->assertEquals($config->getSection('Section')->getSection('SubSection')->getValue('ValueTwo'), $storedConfig->getSection('Section')->getSection('SubSection')->getValue('ValueTwo')); ConfigurationManager::deleteConfiguration(self::TEST_VENDOR, null, null, self::TEST_ENVIRONMENT, self::TEST_NEW_CONFIG_NAME); }
/** * Deletes the configuration specified by the given params. * * @param string $namespace The namespace of the configuration. * @param string $context The current application's context. * @param string $language The current application's language. * @param string $environment The environment, the applications runs on. * @param string $name The name of the configuration to delete including it's extension. * * @throws ConfigurationException In case the file cannot be deleted. * * @author Tobias Lückel * @version * Version 0.1, 27.10.2011<br /> */ public function deleteConfiguration($namespace, $context, $language, $environment, $name) { $name = $this->remapConfigurationName($name); $key = $this->getStoreIdentifier($namespace, $context, $language, $environment, $name); $result = $this->memcachedService->delete($key); if ($result === false) { throw new ConfigurationException('[MemcachedConfigurationProvider::deleteConfiguration()] ' . 'MemcachedConfiguration with key "' . $key . '" cannot be deleted! Please check your ' . 'memcache configuration, the given parameters, or your environment configuration.'); } ConfigurationManager::deleteConfiguration($namespace, $context, $language, $environment, $name); }
/** * Convenience method for deleting a configuration depending on APF DOM attributes and * the current environment. * * @param string $namespace The namespace of the configuration. * @param string $name The name of the configuration including it's extension. * * @author Ralf Schubert * @version * Version 0.1, 27.07.2011<br /> */ protected function deleteConfiguration($namespace, $name) { ConfigurationManager::deleteConfiguration($namespace, $this->getContext(), $this->getLanguage(), Registry::retrieve('APF\\core', 'Environment'), $name); }
public function testDeleteConfigurationFile() { $fileName = __DIR__ . '/' . self::CONFIG_ROOT_FOLDER . '/' . self::TEST_ENVIRONMENT . '_' . self::TEST_NEW_CONFIG_NAME; ConfigurationManager::deleteConfiguration(self::TEST_VENDOR, null, null, self::TEST_ENVIRONMENT, self::TEST_NEW_CONFIG_NAME); if (file_exists($fileName)) { $this->fail('File "' . $fileName . '" has not been deleted by configuration manager!'); } else { $this->assertTrue(true); } }