コード例 #1
0
ファイル: bootstrap.php プロジェクト: gintonicweb/users
//@codingStandardsIgnoreStart
@mkdir(LOGS);
@mkdir(SESSIONS);
@mkdir(CACHE);
@mkdir(CACHE . 'views');
@mkdir(CACHE . 'models');
//@codingStandardsIgnoreEnd
require_once CORE_PATH . 'config/bootstrap.php';
date_default_timezone_set('UTC');
mb_internal_encoding('UTF-8');
Configure::write('debug', true);
Configure::write('App', ['namespace' => 'App', 'encoding' => 'UTF-8', 'base' => false, 'baseUrl' => false, 'dir' => APP_DIR, 'webroot' => 'webroot', 'wwwRoot' => WWW_ROOT, 'fullBaseUrl' => 'http://localhost', 'imageBaseUrl' => 'img/', 'jsBaseUrl' => 'js/', 'cssBaseUrl' => 'css/', 'paths' => ['plugins' => [TEST_APP . 'Plugin' . DS], 'templates' => [APP . 'Template' . DS], 'locales' => [APP . 'Locale' . 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_dsn')) {
    putenv('db_dsn=sqlite:///:memory:');
}
ConnectionManager::config('test', ['url' => getenv('db_dsn')]);
ConnectionManager::config('test_custom_i18n_datasource', ['url' => getenv('db_dsn')]);
Configure::write('Session', ['defaults' => 'php']);
Configure::write('EmailTransport', ['default' => ['className' => 'Debug']]);
Configure::write('Email', ['default' => ['transport' => 'default', 'from' => 'you@localhost']]);
Email::configTransport(Configure::consume('EmailTransport'));
Email::config(Configure::consume('Email'));
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']]);
Router::reload();
Cake\Routing\DispatcherFactory::add('Routing');
Cake\Routing\DispatcherFactory::add('ControllerFactory');
Plugin::load('Users', ['path' => ROOT . DS, 'routes' => true]);
Cake\Utility\Security::salt('8b61f851d8cb3dfcf3b447dc67bd7bf9fe2ed91a916d4457f4969a05a637473d');
コード例 #2
0
define('ROOT', $findRoot());
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/autoload.php';
require CORE_PATH . 'config/bootstrap.php';
Cake\Core\Configure::write('App', ['namespace' => 'TwoFactorAuth\\Test\\App', 'paths' => ['templates' => [APP . 'Template' . DS]]]);
Cake\Core\Configure::write('debug', true);
Cake\Utility\Security::salt('justarandomsaltjustarandomsaltjustarandomsaltjustarandomsaltjustarandomsalt');
$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' => 'two_factor_auth_myapp_cake_core_', 'path' => CACHE . 'persistent/', 'serialize' => true, 'duration' => '+10 seconds'], '_cake_model_' => ['className' => 'File', 'prefix' => 'two_factor_auth_my_app_cake_model_', 'path' => CACHE . 'models/', 'serialize' => 'File', 'duration' => '+10 seconds']];
Cake\Cache\Cache::config($cache);
Cake\Core\Configure::write('Session', ['defaults' => 'php']);
Cake\Core\Plugin::load('TwoFactorAuth', ['path' => ROOT . DS, 'autoload' => true, 'bootstrap' => true]);
// Ensure default test connection is defined
if (!getenv('db_dsn')) {
    putenv('db_dsn=sqlite:///:memory:');
}
Cake\Datasource\ConnectionManager::config('test', ['url' => getenv('db_dsn'), 'timezone' => 'UTC']);