| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- define('DS', DIRECTORY_SEPARATOR);
- define('ROOT', dirname(__DIR__));
- define('TMP', ROOT . DS . 'tmp' . DS);
- define('LOGS', TMP . 'logs' . DS);
- define('CACHE', TMP . 'cache' . DS);
- define('APP', sys_get_temp_dir());
- define('APP_DIR', 'src');
- define('CAKE_CORE_INCLUDE_PATH', ROOT . '/vendor/cakephp/cakephp');
- define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
- define('CAKE', CORE_PATH . APP_DIR . DS);
- require ROOT . '/vendor/cakephp/cakephp/src/basics.php';
- require ROOT . '/vendor/autoload.php';
- Cake\Core\Configure::write('App', ['namespace' => 'App']);
- $Tmp = new \Cake\Utility\Folder(TMP);
- $Tmp->create(TMP . 'cache/models', 0770);
- $Tmp->create(TMP . 'cache/persistent', 0770);
- $Tmp->create(TMP . 'cache/views', 0770);
- $cache = [
- 'default' => [
- 'engine' => 'File'
- ],
- '_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);
- Cake\Core\Plugin::load('Tools', ['path' => './']);
- // 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'),
- 'login' => getenv('db_login'),
- 'password' => getenv('db_password'),
- 'timezone' => 'UTC',
- 'quoteIdentifiers' => true,
- 'cacheMetadata' => true,
- ]);
|