/** * @public * @depends testRegisterReadonlyMethod * * Tests default usage of the retrieve method * * @return void * * @author Florian Horn * @version * Version 0.1, 17.12.2011<br /> */ public function testRetrieveMethod() { Registry::register(self::$REGISTRY_NAMESPACE, self::$REGISTRY_NAME, self::$REGISTRY_VALUE, true); $sReturnValue = Registry::retrieve(self::$REGISTRY_NAMESPACE, self::$REGISTRY_NAME); $this->assertEquals(self::$REGISTRY_VALUE, $sReturnValue); $sReturnValue = Registry::retrieve(self::$REGISTRY_NAMESPACE, self::$REGISTRY_NAME, self::$REGISTRY_DEFAULT_VALUE); $this->assertEquals(self::$REGISTRY_VALUE, $sReturnValue); $sReturnValue = Registry::retrieve(self::$REGISTRY_NAMESPACE . '42', self::$REGISTRY_NAME); $this->assertNull($sReturnValue); $sReturnValue = Registry::retrieve(self::$REGISTRY_NAMESPACE . '42', self::$REGISTRY_NAME, self::$REGISTRY_DEFAULT_VALUE); $this->assertEquals(self::$REGISTRY_DEFAULT_VALUE, $sReturnValue); $sReturnValue = Registry::retrieve(self::$REGISTRY_NAMESPACE, self::$REGISTRY_NAME . '42'); $this->assertNull($sReturnValue); $sReturnValue = Registry::retrieve(self::$REGISTRY_NAMESPACE, self::$REGISTRY_NAME . '42', self::$REGISTRY_DEFAULT_VALUE); $this->assertEquals(self::$REGISTRY_DEFAULT_VALUE, $sReturnValue); $sReturnValue = Registry::retrieve(self::$REGISTRY_NAMESPACE . '42', self::$REGISTRY_NAME . '42'); $this->assertNull($sReturnValue); $sReturnValue = Registry::retrieve(self::$REGISTRY_NAMESPACE . '42', self::$REGISTRY_NAME . '42', self::$REGISTRY_DEFAULT_VALUE); $this->assertEquals(self::$REGISTRY_DEFAULT_VALUE, $sReturnValue); }
* The APF is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The APF is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with the APF. If not, see http://www.gnu.org/licenses/lgpl-3.0.txt. * --> */ echo 'This is a sample setup script, that must be adapted to your requirements! ' . 'Please do not use as is to avoid unexpected results! :)'; exit(0); // include APF bootstrap file require './APF/core/bootstrap.php'; // configure the registry if desired use APF\core\registry\Registry; Registry::register('APF\\core', 'Environment', '{ENVIRONMENT}'); use APF\modules\genericormapper\data\tools\GenericORMapperDomainObjectGenerator; // create setup tool $generator = new GenericORMapperDomainObjectGenerator(); // set context (important for the configuration files!) $generator->setContext('{CONTEXT}'); // initialize mapping configuration $generator->addMappingConfiguration('{CONFIG_NAMESPACE}', '{CONFIG_NAME_AFFIX}'); // initialize domain object configuration $generator->addDomainObjectsConfiguration('{CONFIG_NAMESPACE}', '{CONFIG_NAME_AFFIX}'); $generator->generateServiceObjects();
\APF\core\loader\RootClassLoader::addLoader(new \APF\core\loader\StandardClassLoader('APF', $apfClassLoaderRootPath, $apfClassLoaderConfigurationRootPath)); spl_autoload_register(['\\APF\\core\\loader\\RootClassLoader', 'load']); // 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