예제 #1
0
 public static function tearDownAfterClass()
 {
     // restore previous configuration provider to not disturb other tests
     ConfigurationManager::registerProvider('ini', self::$originalProvider);
     // remove static configuration class loader used for test purposes only
     RootClassLoader::removeLoader(RootClassLoader::getLoaderByVendor(self::TEST_VENDOR));
 }
 /**
  * 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);
 }
 protected function tearDown()
 {
     // restore previous setup to not influence further tests
     ConfigurationManager::registerProvider('ini', $this->initialIniProvider);
 }
예제 #4
0
 /**
  * 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);
 }
예제 #5
0
 /**
  * Initializes the configuration provider for file based statements.
  *
  * @author Christian Achatz
  * @version
  * Version 0.1, 02.02.2011<br />
  * Version 0.2, 04.02.2011 (Switched initialization to a more comfortable implementation)<br />
  */
 public function __construct()
 {
     $providers = ConfigurationManager::getRegisteredProviders();
     if (!in_array(self::$STATEMENT_FILE_EXTENSION, $providers)) {
         ConfigurationManager::registerProvider(self::$STATEMENT_FILE_EXTENSION, new StatementConfigurationProvider());
     }
 }
 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);
     }
 }
예제 #7
0
// register the APF error handler to be able to easily configure the error handling mechanism
GlobalExceptionHandler::registerExceptionHandler(new DefaultExceptionHandler());
GlobalExceptionHandler::enable();
// let PHP raise and display all errors to be able to handle them suitable by the APF error handler.
error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('html_errors', 'off');
// register the APF error handler to be able to easily configure the error handling mechanism
GlobalErrorHandler::registerErrorHandler(new DefaultErrorHandler());
GlobalErrorHandler::enable();
// Define base parameters of the framework's core and tools layer
Registry::register('APF\\core', 'Environment', 'DEFAULT');
Registry::register('APF\\core', 'InternalLogTarget', 'apf');
Registry::register('APF\\core', 'Charset', 'UTF-8');
// set up configuration provider to let the developer customize it later on
ConfigurationManager::registerProvider('ini', new IniConfigurationProvider());
// configure logger (outside namespace'd file! otherwise initialization will not work)
register_shutdown_function(function () {
    /* @var $logger Logger */
    $logger = Singleton::getInstance(Logger::class);
    $logger->flushLogBuffer();
});
// Set up default link scheme configuration. In case url rewriting is required, please
// specify another link scheme within your application bootstrap file.
LinkGenerator::setLinkScheme(new DefaultLinkScheme());
// Add the front controller filter that is a wrapper on the front controller's input
// filters concerning thr url rewriting configuration. In case rewriting is required,
// please specify another input filter within your application bootstrap file according
// to your url mapping requirements (e.g. use the ChainedUrlRewritingInputFilter included
// within the APF).
// As shipped, the APF does not define an output filter since "normal" url handling
예제 #8
0
 /**
  * Loads the service configuration.
  *
  * @param string $configNamespace The namespace of the service (a.k.a. config namespace).
  * @param string $context The context of the current application.
  * @param string $language The language of the current application.
  * @param string $cacheKey The cache key to check/find configuration in configuration cache
  *
  * @return Configuration The appropriate configuration.
  *
  * @author Christian Achatz
  * @version
  * Version 0.1, 04.10.2010<br />
  * Version 0.2, 15.07.2012 Jan Wiese (Introduced configuration cache and $cacheKey parameter)<br />
  */
 private static function getServiceConfiguration($configNamespace, $context, $language, $cacheKey)
 {
     // return cached version as much as possible to gain performance
     if (isset(self::$SERVICE_CONFIG_CACHE[$cacheKey])) {
         return self::$SERVICE_CONFIG_CACHE[$cacheKey];
     }
     self::$SERVICE_CONFIG_CACHE[$cacheKey] = ConfigurationManager::loadConfiguration($configNamespace, $context, $language, Registry::retrieve('APF\\core', 'Environment'), 'serviceobjects.' . self::$configurationExtension);
     return self::$SERVICE_CONFIG_CACHE[$cacheKey];
 }