Example #1
0
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';
Configure::write('App', ['namespace' => $pluginName . '\\Test\\App', 'paths' => ['templates' => [APP . 'Template' . DS]]]);
Configure::write('debug', true);
$TMP = new 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' => strtolower($pluginName) . '_myapp_cake_core_', 'path' => CACHE . 'persistent/', 'serialize' => true, 'duration' => '+10 seconds'], '_cake_model_' => ['className' => 'File', 'prefix' => strtolower($pluginName) . '_my_app_cake_model_', 'path' => CACHE . 'models/', 'serialize' => 'File', 'duration' => '+10 seconds']];
Cake\Cache\Cache::config($cache);
Cake\Core\Configure::write('Session', ['defaults' => 'php']);
// Ensure default test connection is defined
if (!getenv('db_dsn')) {
    putenv('db_dsn=sqlite:///:memory:');
}
Cake\Datasource\ConnectionManager::config('default', ['url' => getenv('db_dsn'), 'quoteIdentifiers' => true, 'timezone' => 'UTC']);
Cake\Datasource\ConnectionManager::config('test', ['url' => getenv('db_dsn'), 'quoteIdentifiers' => true, 'timezone' => 'UTC']);
// Alias AppController to the test App
class_alias($pluginName . '\\Test\\App\\Controller\\AppController', 'App\\Controller\\AppController');
// If plugin has routes.php/bootstrap.php then load them, otherwise don't.
$loadPluginRoutes = file_exists(dirname(__FILE__) . DS . 'config' . DS . 'routes.php');
$loadPluginBootstrap = file_exists(dirname(__FILE__) . DS . 'config' . DS . 'bootstrap.php');
Cake\Core\Plugin::load($pluginName, ['path' => ROOT . DS, 'autoload' => true, 'routes' => $loadPluginRoutes, 'bootstrap' => $loadPluginBootstrap]);
Cake\Routing\DispatcherFactory::add('Routing');
Cake\Routing\DispatcherFactory::add('ControllerFactory');
Example #2
0
define('CONFIG', dirname(__FILE__) . DS . 'config' . DS);
ini_set('intl.default_locale', 'de-DE');
require ROOT . '/vendor/autoload.php';
require CORE_PATH . 'config/bootstrap.php';
Cake\Core\Configure::write('App', ['namespace' => 'App', 'encoding' => 'UTF-8']);
Cake\Core\Configure::write('debug', true);
Cake\Core\Configure::write('EmailTransport', ['default' => ['className' => 'Debug']]);
Cake\Core\Configure::write('Email', ['default' => ['transport' => 'default', 'from' => 'you@localhost']]);
mb_internal_encoding('UTF-8');
$Tmp = new \Cake\Filesystem\Folder(TMP);
$Tmp->create(TMP . 'cache/models', 0770);
$Tmp->create(TMP . 'cache/persistent', 0770);
$Tmp->create(TMP . 'cache/views', 0770);
$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);
Cake\Core\Plugin::load('Queue', ['path' => ROOT . DS]);
Cake\Core\Plugin::load('Tools', ['path' => ROOT . DS . 'plugins' . DS . 'Tools' . DS]);
Cake\Network\Email\Email::configTransport('default', ['className' => 'Debug']);
Cake\Network\Email\Email::configTransport('queue', ['className' => 'Queue.Queue']);
Cake\Network\Email\Email::config('default', ['transport' => 'default']);
// Ensure default test connection is defined
if (!getenv('db_class')) {
    putenv('db_class=Cake\\Database\\Driver\\Sqlite');
    putenv('db_dsn=sqlite::memory:');
}
if (WINDOWS) {
    Cake\Datasource\ConnectionManager::config('test', ['className' => 'Cake\\Database\\Connection', 'driver' => 'Cake\\Database\\Driver\\Mysql', 'database' => 'cake_test', 'username' => 'root', 'password' => '', 'timezone' => 'UTC', 'quoteIdentifiers' => true, 'cacheMetadata' => true]);
    return;
}
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]);
_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_once ROOT . '/vendor/cakephp/cakephp/src/basics.php';
require_once ROOT . '/vendor/autoload.php';
Cake\Core\Configure::write('App', ['namespace' => 'CakeDC\\OracleDriver\\Test\\App']);
Cake\Core\Configure::write('debug', true);
$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' => 'oracle_driver_cake_core_', 'path' => CACHE . 'persistent/', 'serialize' => true, 'duration' => '+10 seconds'], '_cake_model_' => ['className' => 'File', 'prefix' => 'oracle_driver_cake_model_', 'path' => CACHE . 'models/', 'serialize' => 'File', 'duration' => '+10 seconds'], '_cake_method_' => ['className' => 'File', 'prefix' => 'oracle_driver_cake_method_', 'path' => CACHE . 'models/', 'serialize' => 'File', 'duration' => '+10 seconds']];
Cake\Cache\Cache::config($cache);
Cake\Core\Configure::write('Session', ['defaults' => 'php']);
Cake\Core\Plugin::load('CakeDC\\OracleDriver', ['path' => ROOT . DS, 'autoload' => true]);
Cake\Routing\DispatcherFactory::add('Routing');
Cake\Routing\DispatcherFactory::add('ControllerFactory');
// 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']);
Example #4
0
define('ROOT', find_root());
define('APP_DIR', find_app());
define('WEBROOT_DIR', 'webroot');
define('CONFIG', ROOT . DS . 'config' . DS);
define('APP', ROOT . DS . APP_DIR . DS);
define('WWW_ROOT', ROOT . DS . WEBROOT_DIR . DS);
define('TESTS', ROOT . DS . 'Test' . 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' => 'App']);
Cake\Core\Configure::write('debug', 2);
$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', 'path' => CACHE], '_cake_core_' => ['className' => 'File', 'prefix' => 'outside_force_myapp_cake_core_', 'path' => CACHE . 'persistent/', 'serialize' => true, 'duration' => '+10 seconds'], '_cake_model_' => ['className' => 'File', 'prefix' => 'outside_force_my_app_cake_model_', 'path' => CACHE . 'models/', 'serialize' => 'File', 'duration' => '+10 seconds']];
Cake\Cache\Cache::config($cache);
Cake\Core\Plugin::load('OutsideForce', ['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']);
<?php

use Cake\Cache\Cache;
use Cake\Core\Configure;
use Cake\Database\Type;
Configure::write('debug', true);
/**
 * Test suite bootstrap for ModelHistory.
 */
// Customize this to be a relative path for embedded plugins.
// For standalone plugins, this should point at a CakePHP installation.
if (!defined('DS')) {
    define('DS', DIRECTORY_SEPARATOR);
}
define('APP', 'tests' . DS . 'ModelHistoryTestApp' . DS);
define('CONFIG', __DIR__ . DS . '..' . DS . 'config' . DS);
$vendorPos = strpos(__DIR__, 'vendor/codekanzlei/cake-model-history');
if ($vendorPos !== false) {
    // Package has been cloned within another composer package, resolve path to autoloader
    $vendorDir = substr(__DIR__, 0, $vendorPos) . 'vendor/';
    $loader = (require $vendorDir . 'autoload.php');
} else {
    // Package itself (cloned standalone)
    $loader = (require __DIR__ . '/../vendor/autoload.php');
}
Cake\Datasource\ConnectionManager::config('test', ['className' => 'Cake\\Database\\Connection', 'driver' => 'Cake\\Database\\Driver\\Mysql', 'persistent' => false, 'host' => 'localhost', 'username' => 'root', 'password' => '', 'database' => 'model_history_test', 'encoding' => 'utf8', 'timezone' => 'UTC']);
Cache::config('_cake_core_', ['className' => 'File', 'prefix' => 'mh_cake_core_', 'path' => 'cache/persistent/', 'serialize' => true, 'duration' => '+2 minutes']);
Type::map('json', '\\CkTools\\Database\\Type\\JsonType');
Example #6
0
<?php

/**
 * Default database connection.
 *
 * This is different from the Gatekeeper database that's bootstrapped for user
 * management. This database is for your app, the GK one is for your users.
 *
 * They CAN be the same, but be mindful of table name clashes.
 *
 * Access credentials are changed in the `.env` file in the root of the app.
 */
Cake\Datasource\ConnectionManager::config('default', ['className' => 'Cake\\Database\\Connection', 'driver' => 'Cake\\Database\\Driver\\Mysql', 'persistent' => false, 'host' => getenv('MAIN_DB_HOST'), 'username' => getenv('MAIN_DB_USER'), 'password' => getenv('MAIN_DB_PASS'), 'database' => getenv('MAIN_DB_NAME'), 'encoding' => 'utf8', 'timezone' => 'UTC', 'cacheMetadata' => false]);
Example #7
0
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' => 'App']);
Cake\Core\Configure::write('debug', 2);
$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', 'path' => CACHE], '_cake_core_' => ['className' => 'File', 'prefix' => 'search_myapp_cake_core_', 'path' => CACHE . 'persistent/', 'serialize' => true, 'duration' => '+10 seconds'], '_cake_model_' => ['className' => 'File', 'prefix' => 'search_my_app_cake_model_', 'path' => CACHE . 'models/', 'serialize' => 'File', 'duration' => '+10 seconds']];
Cake\Cache\Cache::config($cache);
// Ensure default test connection is defined
//travis対応
if (!getenv('TESTDB') || getenv('TESTDB') == 'postgresql') {
    if (!getenv('db_class')) {
        putenv('db_class=Cake\\Database\\Driver\\Postgres');
        putenv('db_dsn=sqlite::memory:');
    }
    Cake\Datasource\ConnectionManager::config('test', ['className' => 'Cake\\Database\\Connection', 'driver' => 'Cake\\Database\\Driver\\Postgres', 'database' => 'cake_test_db', 'username' => 'postgres', 'password' => '', 'timezone' => 'UTC']);
} else {
    if (!getenv('db_class')) {
        putenv('db_class=Cake\\Database\\Driver\\Mysql');
        putenv('db_dsn=sqlite::memory:');
    }
    Cake\Datasource\ConnectionManager::config('test', ['className' => 'Cake\\Database\\Connection', 'driver' => 'Cake\\Database\\Driver\\Mysql', 'database' => 'cake_test_db', 'username' => 'root', 'password' => '', 'timezone' => 'UTC']);
}