phpci/bootstrap.php

52 lines
1.5 KiB
PHP
Raw Normal View History

2013-05-03 17:02:53 +02:00
<?php
2013-05-16 03:16:56 +02:00
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2013, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link http://www.phptesting.org/
2013-05-16 03:16:56 +02:00
*/
2013-05-03 17:02:53 +02:00
// Let PHP take a guess as to the default timezone, if the user hasn't set one:
date_default_timezone_set(@date_default_timezone_get());
// Set up a basic autoloader for PHPCI:
$autoload = function ($class) {
$file = str_replace(array('\\', '_'), '/', $class);
$file .= '.php';
2013-05-03 17:02:53 +02:00
if (substr($file, 0, 1) == '/') {
$file = substr($file, 1);
}
2013-05-03 17:02:53 +02:00
if (is_file(dirname(__FILE__) . '/' . $file)) {
include(dirname(__FILE__) . '/' . $file);
return;
}
};
2013-05-03 17:02:53 +02:00
spl_autoload_register($autoload, true, true);
2013-05-03 17:02:53 +02:00
// Define our APPLICATION_PATH, if not already defined:
if (!defined('APPLICATION_PATH')) {
define('APPLICATION_PATH', dirname(__FILE__) . '/');
}
2013-05-03 17:02:53 +02:00
// Load Composer autoloader:
require_once(APPLICATION_PATH . 'vendor/autoload.php');
2013-05-15 20:37:56 +02:00
// Load configuration if present:
if (file_exists(APPLICATION_PATH . 'config.php')) {
require(APPLICATION_PATH . 'config.php');
// Define our PHPCI_URL, if not already defined:
if (!defined('PHPCI_URL')) {
define('PHPCI_URL', $registry->get('install_url', '') . '/');
}
2013-05-15 20:37:56 +02:00
}
2013-05-03 17:02:53 +02:00
// Set up the registry:
2013-05-03 17:02:53 +02:00
b8\Registry::getInstance()->set('app_namespace', 'PHPCI');
b8\Registry::getInstance()->set('DefaultController', 'Index');
b8\Registry::getInstance()->set('ViewPath', dirname(__FILE__) . '/PHPCI/View/');