PHP Classes

File: tests/bootstrap.php

Recommend this page to a friend!
  Classes of Everton C B Junior   PHP CKEditor Library   tests/bootstrap.php   Download  
File: tests/bootstrap.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP CKEditor Library
Use the CKEditor to edit HTML in a form input
Author: By
Last change:
Date: 3 years ago
Size: 2,256 bytes
 

Contents

Class file image Download
<?php

require dirname(__DIR__) . '/vendor/cakephp/cakephp/src/basics.php';
require
dirname(__DIR__) . '/vendor/autoload.php';

if (!
defined('WINDOWS')) {
    if (
DS == '\\' || substr(PHP_OS, 0, 3) === 'WIN') {
       
define('WINDOWS', true);
    } else {
       
define('WINDOWS', false);
    }
}

define('ROOT', dirname(__DIR__));
define('APP_DIR', 'src');

define('APP', rtrim(sys_get_temp_dir(), DS) . DS . APP_DIR . DS);
if (!
is_dir(APP)) {
   
mkdir(APP, 0770, true);
}

define('TMP', ROOT . DS . 'tmp' . DS);
if (!
is_dir(TMP)) {
   
mkdir(TMP, 0770, true);
}

define('CONFIG', dirname(__FILE__) . DS . 'config' . 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);

Cake\Core\Configure::write('App', [
   
'namespace' => 'TestApp'
]);

Cake\Core\Configure::write('debug', true);

$cache = [
   
'default' => [
       
'engine' => 'File',
       
'path' => CACHE
   
],
   
'_cake_core_' => [
       
'className' => 'File',
       
'prefix' => 'crud_myapp_cake_core_',
       
'path' => CACHE . 'persistent/',
       
'serialize' => true,
       
'duration' => '+10 seconds'
   
],
   
'_cake_model_' => [
       
'className' => 'File',
       
'prefix' => 'crud_my_app_cake_model_',
       
'path' => CACHE . 'models/',
       
'serialize' => 'File',
       
'duration' => '+10 seconds'
   
]
];

Cake\Cache\Cache::config($cache);

//needed?
Cake\Core\Plugin::load('Geo', ['path' => ROOT . DS, 'autoload' => true]);

if (
file_exists(CONFIG . 'app_local.php')) {
    \
Cake\Core\Configure::load('app_local', 'default');
}

// Ensure default test connection is defined
if (!getenv('db_class')) {
   
putenv('db_class=Cake\Database\Driver\Sqlite');
   
putenv('db_dsn=sqlite::memory:');
}

Cake\Datasource\ConnectionManager::config('test', [
   
'className' => 'Cake\Database\Connection',
   
'driver' => getenv('db_class'),
   
'dsn' => getenv('db_dsn'),
   
'database' => getenv('db_database'),
   
'username' => getenv('db_username'),
   
'password' => getenv('db_password'),
   
'timezone' => 'UTC',
   
'quoteIdentifiers' => true,
   
'cacheMetadata' => true,
]);