Files
cheese-cake/tests/bootstrap.php
Brandon Shipley eb721f831c
All checks were successful
CI / testsuite (pgsql, 8.2, ) (push) Successful in 4m55s
CI / testsuite (mysql, 8.2, ) (push) Successful in 5m13s
CI / testsuite (mysql, 8.4, ) (push) Successful in 9m14s
CI / testsuite (sqlite, 8.2, ) (push) Successful in 4m49s
CI / testsuite (pgsql, 8.4, ) (push) Successful in 8m13s
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Successful in 4m56s
CI / Coding Standard & Static Analysis (push) Successful in 3m9s
CI / testsuite (sqlite, 8.4, ) (push) Successful in 6m28s
composer update phpunit 10.3, remove define in tests bootstrap
2026-03-21 00:19:49 -07:00

74 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
use Cake\Core\Configure;
//use Cake\TestSuite\Fixture\SchemaLoader;
define('PLUGIN_ROOT', dirname(__DIR__));
define('TESTS', __DIR__ . DS);
ini_set('intl.default_locale', 'en-US');
/**
* Test suite bootstrap for CheeseCakePlugin.
*
* This function is used to find the location of CakePHP whether CakePHP
* has been installed as a dependency of the plugin, or the plugin is itself
* 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);
throw new Exception('Cannot find the root of the application, unable to run tests');
};
$root = $findRoot(__FILE__);
unset($findRoot);
chdir($root);
require_once $root . '/vendor/autoload.php';
/**
* Define fallback values for required constants and configuration.
* To customize constants and configuration remove this require
* and define the data required by your plugin here.
*/
require_once $root . '/vendor/cakephp/cakephp/tests/bootstrap.php';
if (file_exists($root . '/config/bootstrap.php')) {
require $root . '/config/bootstrap.php';
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.
*
* If your plugin does not use database fixtures you can
* safely delete this.
*
* If you want to support multiple databases, consider
* using migrations to provide schema for your plugin,
* and using \Migrations\TestSuite\Migrator to load schema.
*/
// Load a schema dump file.
//(new SchemaLoader())->loadSqlFiles('tests/schema.sql', 'test');