32 lines
952 B
PHP
32 lines
952 B
PHP
<?php
|
|
|
|
/**
|
|
* Minimal bootstrap for the unit tests: loads the composer autoloader and the
|
|
* CodeIgniter 4 core functions (log_message, config, ...) without booting the
|
|
* application (no database, session or routing). WRITEPATH points to a temp
|
|
* dir so tests never touch writable/logs.
|
|
*/
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
define('ENVIRONMENT', 'testing');
|
|
define('CI_DEBUG', true);
|
|
|
|
$root = dirname(__DIR__);
|
|
$tmp = sys_get_temp_dir() . '/dbois-phpunit-' . getmypid() . '/';
|
|
mkdir($tmp . 'logs', 0777, true);
|
|
register_shutdown_function(static function () use ($tmp) {
|
|
array_map('unlink', glob($tmp . 'logs/*') ?: []);
|
|
@rmdir($tmp . 'logs');
|
|
@rmdir($tmp);
|
|
});
|
|
|
|
define('ROOTPATH', $root . '/');
|
|
define('APPPATH', $root . '/app/');
|
|
define('WRITEPATH', $tmp);
|
|
define('SYSTEMPATH', $root . '/vendor/codeigniter4/framework/system/');
|
|
define('FCPATH', $root . '/public/');
|
|
|
|
require $root . '/vendor/autoload.php';
|
|
require SYSTEMPATH . 'Common.php';
|