Files
FOSSBilling/tests-legacy/bootstrap.php
T
Adam DaleyandCopilot a0b3158b30 PHPUnit test-legacy refactor and cleanup (#3144)
* PHPUnit test-legacy cleanup

Refactor and cleanup the legacy PHPUnit tests.

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-13 17:32:09 +00:00

47 lines
1.3 KiB
PHP

<?php
putenv('APP_ENV=test');
define('PATH_TESTS', __DIR__);
require_once __DIR__ . '/../src/load.php';
require_once __DIR__ . '/../src/vendor/autoload.php';
$config = include __DIR__ . '/../src/config.php';
define('BB_DB_NAME', $config['db']['name']);
define('BB_DB_USER', $config['db']['user']);
define('BB_DB_PASSWORD', $config['db']['password']);
define('BB_DB_HOST', $config['db']['host']);
define('BB_DB_TYPE', $config['db']['type']);
// Add test libraries
set_include_path(implode(PATH_SEPARATOR, [
get_include_path(),
PATH_TESTS . '/library',
PATH_TESTS . '/includes',
PATH_TESTS . '/includes/Vps',
]));
require_once 'BBTestCase.php';
require_once 'BBDatabaseTestCase.php';
require_once 'BBDbApiTestCase.php';
require_once 'ApiTestCase.php';
require_once 'BBModTestCase.php';
require_once PATH_TESTS . '/includes/Payment/Adapter/Dummy.php';
require_once 'FakeTemplateWrapper.php';
require_once 'DummyBean.php';
$di = include PATH_ROOT . '/di.php';
$di['translate']();
$di['validator'] = function () {
return new FOSSBilling\Validate();
};
$di['tools'] = function () {
return new FOSSBilling\Tools();
};
// Setup the autoloader
$testsLoader = new AntCMS\AntLoader([
'mode' => 'filesystem',
]);
$testsLoader->addNamespace('', DIRECTORY_SEPARATOR . 'library', 'psr0');
$testsLoader->register();