浏览代码

bootstrap

euromark 11 年之前
父节点
当前提交
36fcde68a6
共有 1 个文件被更改,包括 43 次插入1 次删除
  1. 43 1
      Test/bootstrap.php

+ 43 - 1
Test/bootstrap.php

@@ -27,4 +27,46 @@ require ROOT . '/vendor/autoload.php';
 $TMP = new \Cake\Utility\Folder(TMP);
 $TMP = new \Cake\Utility\Folder(TMP);
 $TMP->create(TMP . 'cache/models', 0777);
 $TMP->create(TMP . 'cache/models', 0777);
 $TMP->create(TMP . 'cache/persistent', 0777);
 $TMP->create(TMP . 'cache/persistent', 0777);
-$TMP->create(TMP . 'cache/views', 0777);
+$TMP->create(TMP . 'cache/views', 0777);
+
+$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' => './']);
+
+$datasources = [
+	'test' => [
+		'className' => 'Cake\Database\Connection',
+		'driver' => 'Cake\Database\Driver\Mysql',
+		'persistent' => false,
+		'host' => 'localhost',
+		'login' => 'tools',
+		'password' => 'tools',
+		'database' => 'tools',
+		'prefix' => false,
+		'encoding' => 'utf8',
+	]
+];
+
+$datasources['default'] = $datasources['test'];
+
+Cake\Datasource\ConnectionManager::config($datasources);