Repository navigation
Expand file tree
/
Copy pathbootstrap.php
More file actions
123 lines (107 loc) · 3.33 KB
/
Copy pathbootstrap.php
File metadata and controls
123 lines (107 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
/**
* CakeManager (http://cakemanager.org)
* Copyright (c) http://cakemanager.org
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) http://cakemanager.org
* @link http://cakemanager.org CakeManager Project
* @since 1.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Cache\Cache;
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\Datasource\ConnectionManager;
use Cake\Log\Log;
use Cake\Routing\DispatcherFactory;
require_once 'vendor/autoload.php';
define('ROOT', dirname(__DIR__) . DS);
define('CAKE_CORE_INCLUDE_PATH', ROOT . 'vendor' . DS . 'cakephp' . DS . 'cakephp');
define('CORE_PATH', ROOT . 'vendor' . DS . 'cakephp' . DS . 'cakephp' . DS);
define('CAKE', CORE_PATH . 'src' . DS);
define('APP', ROOT . 'tests' . DS . 'App' . DS);
define('TMP', sys_get_temp_dir() . DS);
define('CACHE', TMP);
define('LOGS', TMP);
define('CONFIG', ROOT . 'config' . DS);
//@codingStandardsIgnoreStart
@mkdir(LOGS);
@mkdir(SESSIONS);
@mkdir(CACHE);
@mkdir(CACHE . 'views');
@mkdir(CACHE . 'models');
//@codingStandardsIgnoreEnd
require CAKE . 'Core/ClassLoader.php';
$loader = new Cake\Core\ClassLoader;
$loader->register();
require_once CORE_PATH . 'config' . DS . 'bootstrap.php';
date_default_timezone_set('UTC');
mb_internal_encoding('UTF-8');
Configure::write('debug', true);
Configure::write('App', [
'namespace' => 'CakeManager\Test\App',
'encoding' => 'UTF-8',
'base' => false,
'baseUrl' => false,
'dir' => 'src',
'webroot' => 'webroot',
'www_root' => APP . 'webroot',
'fullBaseUrl' => 'http://localhost',
'imageBaseUrl' => 'img/',
'jsBaseUrl' => 'js/',
'cssBaseUrl' => 'css/',
'paths' => [
'plugins' => [APP . 'Plugin' . DS],
'templates' => [APP . 'Template' . DS]
]
]);
Cache::config([
'_cake_core_' => [
'engine' => 'File',
'prefix' => 'cake_core_',
'serialize' => true
],
'_cake_model_' => [
'engine' => 'File',
'prefix' => 'cake_model_',
'serialize' => true
]
]);
// Ensure default test connection is defined
if (!getenv('db_class')) {
putenv('db_class=Cake\Database\Driver\Sqlite');
putenv('db_dsn=sqlite::memory:');
}
ConnectionManager::config('test', [
'className' => 'Cake\Database\Connection',
'driver' => getenv('db_class'),
'dsn' => getenv('db_dsn'),
'database' => getenv('db_database'),
'username' => getenv('db_login'),
'password' => getenv('db_password'),
'timezone' => 'UTC'
]);
Configure::write('Session', [
'defaults' => 'php'
]);
Log::config([
'debug' => [
'engine' => 'Cake\Log\Engine\FileLog',
'levels' => ['notice', 'info', 'debug'],
'file' => 'debug',
],
'error' => [
'engine' => 'Cake\Log\Engine\FileLog',
'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'],
'file' => 'error',
]
]);
Plugin::load('Utils', ['path' => ROOT, 'bootstrap' => true, 'routes' => true]);
Plugin::load('CakeManager', ['path' => ROOT, 'bootstrap' => true, 'routes' => true]);
Carbon\Carbon::setTestNow(Carbon\Carbon::now());
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');