Exemplo n.º 1
0
include_once dirname(__FILE__) . '/loader/ClassLoader.php';
include_once dirname(__FILE__) . '/loader/StandardClassLoader.php';
include_once dirname(__FILE__) . '/loader/RootClassLoader.php';
// register class loader before including/configuring further elements
\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());
Exemplo n.º 2
0
 *
 * 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.
 * -->
 */
/**
 * Bootstrap to start test application environment.<br />
 *
 * @author Florian Horn
 * @version
 * Version 0.1, 17.12.2011<br />
 * Version 0.2, 19.10.2015 (Removed static assertions include to ensure compatibility with newer PHPUnit and composer)<br />
 */
$_SERVER['SERVER_PORT'] = '80';
$_SERVER['HTTP_HOST'] = 'localhost';
$_SERVER['REQUEST_URI'] = '';
define('UnittestDir', dirname(__FILE__));
date_default_timezone_set('Europe/Berlin');
//
// --- Loading first resources
//
require_once __DIR__ . '/../../../core/bootstrap.php';
use APF\core\errorhandler\GlobalErrorHandler;
use APF\core\exceptionhandler\GlobalExceptionHandler;
GlobalErrorHandler::disable();
GlobalExceptionHandler::disable();