-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbootstrap.php
More file actions
51 lines (40 loc) · 1.22 KB
/
bootstrap.php
File metadata and controls
51 lines (40 loc) · 1.22 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
<?php
declare(strict_types=1);
use Cake\Cache\Cache;
use Cake\Core\Configure;
use Cake\TestSuite\Fixture\SchemaLoader;
/**
* Test runner bootstrap.
*
* Add additional configuration/setup your application needs when running
* unit tests in this file.
*/
require dirname(__DIR__) . '/vendor/autoload.php';
require dirname(__DIR__) . '/config/bootstrap.php';
$_SERVER['PHP_SELF'] = '/';
define('IS_TEST', true);
Configure::write('App.fullBaseUrl', 'http://localhost');
putenv('DB=sqlite');
ini_set('error_reporting', E_ALL);
Configure::write('debug', true);
// Fixate sessionid early on, as php7.2+
// does not allow the sessionid to be set after stdout
// has been written to.
session_id('cli');
/*
* Set test database and load schema
* @link https://book.cakephp.org/4/en/development/testing.html#creating-test-database-schema
*/
putenv('DB_DSN=sqlite:///:memory:');
(new SchemaLoader())->loadInternalFile(__DIR__ . DS . 'schema.php');
// @todo: Remove when support for CakePHP 5.0 is dropped
if (!Cache::getConfig('_cake_core_')) {
Cache::setConfig([
'_cake_core_' => [
'engine' => 'File',
'prefix' => 'cake_core_',
'serialize' => true,
'path' => CACHE,
],
]);
}