FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
users/tests/bootstrap.php at master · sdevore/users · GitHub
sdevore
/
users
Public
forked from
CakeDC/users
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
users
/
tests
/
bootstrap.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
126 lines (111 loc) · 3.62 KB
Breadcrumbs
users
/
tests
/
bootstrap.php
Copy path
File metadata and controls
126 lines (111 loc) · 3.62 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
124
125
126
<?php
/**
* Copyright 2010 - 2017, Cake Development Corporation (https://www.cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2010 - 2017, Cake Development Corporation (https://www.cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Test suite bootstrap.
*
* This function is used to find the location of CakePHP whether CakePHP
* has been installed as a dependency of the plugin, or the plugin is itself
* installed as a dependency of an application.
*/
$
findRoot
=
function
(
$
root
) {
do
{
$
lastRoot
=
$
root
;
$
root
=
dirname
(
$
root
);
if
(
is_dir
(
$
root
.
'
/vendor/cakephp/cakephp
'
)) {
return
$
root
;
}
}
while
(
$
root
!==
$
lastRoot
);
throw
new
Exception
(
"
Cannot find the root of the application, unable to run tests
"
);
};
$
root
=
$
findRoot
(
__FILE__
);
unset(
$
findRoot
);
chdir
(
$
root
);
if
(!
defined
(
'
DS
'
)) {
define
(
'
DS
'
,
DIRECTORY_SEPARATOR
);
}
define
(
'
ROOT
'
,
$
root
);
define
(
'
APP_DIR
'
,
'
App
'
);
define
(
'
WEBROOT_DIR
'
,
'
webroot
'
);
define
(
'
APP
'
,
ROOT
.
'
/tests/App/
'
);
define
(
'
CONFIG
'
,
ROOT
.
'
/tests/config/
'
);
define
(
'
WWW_ROOT
'
,
ROOT
.
DS
.
WEBROOT_DIR
.
DS
);
define
(
'
TESTS
'
,
ROOT
.
DS
.
'
tests
'
.
DS
);
define
(
'
TMP
'
,
ROOT
.
DS
.
'
tmp
'
.
DS
);
define
(
'
LOGS
'
,
TMP
.
'
logs
'
.
DS
);
define
(
'
CACHE
'
,
TMP
.
'
cache
'
.
DS
);
define
(
'
CAKE_CORE_INCLUDE_PATH
'
,
ROOT
.
'
/vendor/cakephp/cakephp
'
);
define
(
'
CORE_PATH
'
,
CAKE_CORE_INCLUDE_PATH
.
DS
);
define
(
'
CAKE
'
,
CORE_PATH
.
'
src
'
.
DS
);
require
ROOT
.
'
/vendor/cakephp/cakephp/src/basics.php
'
;
require
ROOT
.
'
/vendor/autoload.php
'
;
Cake
\
Core
\Configure::
write
(
'
App
'
, [
'
namespace
'
=>
'
Users\Test\App
'
]);
Cake
\
Core
\Configure::
write
(
'
debug
'
,
true
);
Cake
\
Core
\Configure::
write
(
'
App.encoding
'
,
'
UTF-8
'
);
ini_set
(
'
intl.default_locale
'
,
'
en_US
'
);
$
TMP
=
new
\
Cake
\
Filesystem
\
Folder
(
TMP
);
$
TMP
->
create
(
TMP
.
'
cache/models
'
,
0777
);
$
TMP
->
create
(
TMP
.
'
cache/persistent
'
,
0777
);
$
TMP
->
create
(
TMP
.
'
cache/views
'
,
0777
);
$
cache
= [
'
default
'
=> [
'
engine
'
=>
'
File
'
,
],
'
_cake_core_
'
=> [
'
className
'
=>
'
File
'
,
'
prefix
'
=>
'
users_myapp_cake_core_
'
,
'
path
'
=>
CACHE
.
'
persistent/
'
,
'
serialize
'
=>
true
,
'
duration
'
=>
'
+10 seconds
'
,
],
'
_cake_model_
'
=> [
'
className
'
=>
'
File
'
,
'
prefix
'
=>
'
users_app_cake_model_
'
,
'
path
'
=>
CACHE
.
'
models/
'
,
'
serialize
'
=>
'
File
'
,
'
duration
'
=>
'
+10 seconds
'
,
],
];
Cake
\
Cache
\Cache::
setConfig
(
$
cache
);
Cake
\
Core
\Configure::
write
(
'
Session
'
, [
'
defaults
'
=>
'
php
'
]);
//init router
\
Cake
\
Routing
\Router::
reload
();
\
Cake
\
Core
\Plugin::
load
(
'
CakeDC/Users
'
, [
'
path
'
=>
dirname
(
dirname
(
__FILE__
)) .
DS
,
'
routes
'
=>
true
]);
if
(
file_exists
(
$
root
.
'
/config/bootstrap.php
'
)) {
require
$
root
.
'
/config/bootstrap.php
'
;
}
Cake
\
Routing
\DispatcherFactory::
add
(
'
Routing
'
);
Cake
\
Routing
\DispatcherFactory::
add
(
'
ControllerFactory
'
);
class_alias
(
'
CakeDC\Users\Test\App\Controller\AppController
'
,
'
App\Controller\AppController
'
);
// Ensure default test connection is defined
if
(!
getenv
(
'
db_dsn
'
)) {
putenv
(
'
db_dsn=sqlite:///:memory:
'
);
}
Cake
\
Datasource
\ConnectionManager::
setConfig
(
'
test
'
, [
'
url
'
=>
getenv
(
'
db_dsn
'
),
// 'className' => 'Cake\Database\Connection',
// 'driver' => 'Cake\Database\Driver\Postgres',
// 'persistent' => true,
// 'host' => 'localhost',
// 'username' => 'my_app',
// 'password' => null,
// 'database' => 'test',
// 'schema' => 'public',
// 'port' => 5432,
// 'encoding' => 'utf8',
// 'flags' => [],
// 'init' => [],
'
timezone
'
=>
'
UTC
'
]);
Back
|
FazBrowse Home
|
New Git URL