php-censor/tests/bootstrap.php

59 lines
1.5 KiB
PHP
Raw Normal View History

<?php
/**
2016-05-19 17:25:43 +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/
*/
2016-05-19 17:25:43 +02:00
if (!defined('ROOT_DIR')) {
define('ROOT_DIR', dirname(__DIR__) . DIRECTORY_SEPARATOR);
}
2016-07-21 17:20:34 +02:00
if (!defined('SRC_DIR')) {
define('SRC_DIR', ROOT_DIR . 'src' . DIRECTORY_SEPARATOR . 'PHPCensor' . DIRECTORY_SEPARATOR);
2016-05-19 17:25:43 +02:00
}
2016-07-21 17:20:34 +02:00
if (!defined('PUBLIC_DIR')) {
define('PUBLIC_DIR', ROOT_DIR . 'public' . DIRECTORY_SEPARATOR);
2016-05-19 17:25:43 +02:00
}
2016-07-21 17:20:34 +02:00
if (!defined('APP_DIR')) {
define('APP_DIR', ROOT_DIR . 'app' . DIRECTORY_SEPARATOR);
2016-05-19 17:25:43 +02:00
}
2016-07-21 17:20:34 +02:00
if (!defined('BIN_DIR')) {
define('BIN_DIR', ROOT_DIR . 'bin' . DIRECTORY_SEPARATOR);
2016-05-19 17:25:43 +02:00
}
2016-07-21 17:20:34 +02:00
if (!defined('RUNTIME_DIR')) {
define('RUNTIME_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR);
2016-05-19 17:25:43 +02:00
}
2014-12-08 16:09:57 +01:00
2016-05-19 17:25:43 +02:00
require_once(ROOT_DIR . 'vendor/autoload.php');
2014-12-25 22:20:11 +01:00
// Load configuration if present:
2016-05-19 17:25:43 +02:00
$conf = [];
2016-07-19 20:28:11 +02:00
$conf['b8']['app']['namespace'] = 'PHPCensor';
2014-12-25 22:20:11 +01:00
$conf['b8']['app']['default_controller'] = 'Home';
2016-07-21 17:20:34 +02:00
$conf['b8']['view']['path'] = SRC_DIR . 'View' . DIRECTORY_SEPARATOR;
2014-12-25 22:20:11 +01:00
$config = new b8\Config($conf);
2016-07-21 17:20:34 +02:00
$configFile = APP_DIR . 'config.yml';
2014-12-08 16:09:57 +01:00
if (file_exists($configFile)) {
$config->loadYaml($configFile);
}
2016-07-21 17:20:34 +02:00
if (!defined('APP_URL') && !empty($config)) {
2016-07-21 19:02:11 +02:00
define('APP_URL', $config->get('php-censor.url', '') . '/');
2016-05-19 17:25:43 +02:00
}
\PHPCensor\Helper\Lang::init($config, 'en');
2017-02-18 04:31:33 +01:00
define('DB_NAME', getenv('DB_NAME'));
define('DB_USER', getenv('DB_USER'));
define('DB_TYPE', getenv('DB_TYPE'));
define('DB_PASS', getenv('DB_PASS'));