bootstrap.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * Test runner bootstrap.
  4. *
  5. * Add additional configuration/setup your application needs when running
  6. * unit tests in this file.
  7. */
  8. //require dirname(__DIR__) . '/../Config/bootstrap.php';
  9. define('DS', DIRECTORY_SEPARATOR);
  10. define('ROOT', dirname(dirname(dirname(dirname(__FILE__)))));
  11. define('APP_DIR', 'App');
  12. define('WEBROOT_DIR', 'webroot');
  13. define('APP', ROOT . DS . APP_DIR . DS);
  14. define('WWW_ROOT', ROOT . DS . WEBROOT_DIR . DS);
  15. define('TESTS', ROOT . DS . 'Test' . DS);
  16. define('TMP', ROOT . DS . 'tmp' . DS);
  17. define('LOGS', TMP . 'logs' . DS);
  18. define('CACHE', TMP . 'cache' . DS);
  19. define('CAKE_CORE_INCLUDE_PATH', ROOT . '/vendor/cakephp/cakephp');
  20. define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
  21. define('CAKE', CORE_PATH . 'src' . DS);
  22. require ROOT . '/vendor/cakephp/cakephp/src/basics.php';
  23. require ROOT . '/vendor/autoload.php';
  24. $TMP = new \Cake\Utility\Folder(TMP);
  25. $TMP->create(TMP . 'cache/models', 0777);
  26. $TMP->create(TMP . 'cache/persistent', 0777);
  27. $TMP->create(TMP . 'cache/views', 0777);
  28. $cache = [
  29. 'default' => [
  30. 'engine' => 'File'
  31. ],
  32. '_cake_core_' => [
  33. 'className' => 'File',
  34. 'prefix' => 'crud_myapp_cake_core_',
  35. 'path' => CACHE . 'persistent/',
  36. 'serialize' => true,
  37. 'duration' => '+10 seconds'
  38. ],
  39. '_cake_model_' => [
  40. 'className' => 'File',
  41. 'prefix' => 'crud_my_app_cake_model_',
  42. 'path' => CACHE . 'models/',
  43. 'serialize' => 'File',
  44. 'duration' => '+10 seconds'
  45. ]
  46. ];
  47. Cake\Cache\Cache::config($cache);
  48. Cake\Core\Plugin::load('Tools', ['path' => './']);
  49. $datasources = [
  50. 'test' => [
  51. 'className' => 'Cake\Database\Connection',
  52. 'driver' => 'Cake\Database\Driver\Mysql',
  53. 'persistent' => false,
  54. 'host' => 'localhost',
  55. 'login' => 'tools',
  56. 'password' => 'tools',
  57. 'database' => 'tools',
  58. 'prefix' => false,
  59. 'encoding' => 'utf8',
  60. ]
  61. ];
  62. $datasources['default'] = $datasources['test'];
  63. Cake\Datasource\ConnectionManager::config($datasources);