testing brought in
This commit is contained in:
@@ -1,6 +1,27 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Cake\Core\Configure;
|
||||
|
||||
//use Cake\TestSuite\Fixture\SchemaLoader;
|
||||
|
||||
define('PLUGIN_ROOT', dirname(__DIR__));
|
||||
define('ROOT', PLUGIN_ROOT . DS . 'tests' . DS . 'test_app');
|
||||
define('TMP', PLUGIN_ROOT . DS . 'tmp' . DS);
|
||||
define('LOGS', TMP . 'logs' . DS);
|
||||
define('CACHE', TMP . 'cache' . DS);
|
||||
define('APP', ROOT . DS . 'src' . DS);
|
||||
define('APP_DIR', 'src');
|
||||
define('CAKE_CORE_INCLUDE_PATH', PLUGIN_ROOT . '/vendor/cakephp/cakephp');
|
||||
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
|
||||
define('CAKE', CORE_PATH . APP_DIR . DS);
|
||||
|
||||
define('WWW_ROOT', PLUGIN_ROOT . DS . 'webroot' . DS);
|
||||
define('TESTS', __DIR__ . DS);
|
||||
define('CONFIG', TESTS . 'config' . DS);
|
||||
|
||||
ini_set('intl.default_locale', 'en-US');
|
||||
|
||||
/**
|
||||
* Test suite bootstrap for CheeseCakePlugin.
|
||||
*
|
||||
@@ -9,15 +30,15 @@ declare(strict_types=1);
|
||||
* installed as a dependency of an application.
|
||||
*/
|
||||
$findRoot = function ($root) {
|
||||
do {
|
||||
$lastRoot = $root;
|
||||
$root = dirname($root);
|
||||
if (is_dir($root . '/vendor/cakephp/cakephp')) {
|
||||
return $root;
|
||||
}
|
||||
} while ($root !== $lastRoot);
|
||||
do {
|
||||
$lastRoot = $root;
|
||||
$root = dirname($root);
|
||||
if (is_dir($root . '/vendor/cakephp/cakephp')) {
|
||||
return $root;
|
||||
}
|
||||
} while ($root !== $lastRoot);
|
||||
|
||||
throw new Exception('Cannot find the root of the application, unable to run tests');
|
||||
throw new Exception('Cannot find the root of the application, unable to run tests');
|
||||
};
|
||||
$root = $findRoot(__FILE__);
|
||||
unset($findRoot);
|
||||
@@ -34,11 +55,21 @@ require_once $root . '/vendor/autoload.php';
|
||||
require_once $root . '/vendor/cakephp/cakephp/tests/bootstrap.php';
|
||||
|
||||
if (file_exists($root . '/config/bootstrap.php')) {
|
||||
require $root . '/config/bootstrap.php';
|
||||
require $root . '/config/bootstrap.php';
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
Configure::write('App', [
|
||||
'namespace' => 'TestApp',
|
||||
'encoding' => 'UTF-8',
|
||||
'paths' => [
|
||||
'testWebroot' => PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'webroot' . DS,
|
||||
'webroot' => PLUGIN_ROOT . DS . 'webroot' . DS,
|
||||
'templates' => [
|
||||
PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'templates' . DS,
|
||||
],
|
||||
],
|
||||
]);
|
||||
/**
|
||||
* Load schema from a SQL dump file.
|
||||
*
|
||||
@@ -49,7 +80,6 @@ if (file_exists($root . '/config/bootstrap.php')) {
|
||||
* using migrations to provide schema for your plugin,
|
||||
* and using \Migrations\TestSuite\Migrator to load schema.
|
||||
*/
|
||||
use Cake\TestSuite\Fixture\SchemaLoader;
|
||||
|
||||
// Load a schema dump file.
|
||||
(new SchemaLoader())->loadSqlFiles('tests/schema.sql', 'test');
|
||||
//(new SchemaLoader())->loadSqlFiles('tests/schema.sql', 'test');
|
||||
|
||||
Reference in New Issue
Block a user