diff options
author | Peter Zhang <peter@innocraft.com> | 2021-10-28 12:27:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 12:27:32 +0300 |
commit | 7de92b4037ebd47772548783fc06519f080b8daa (patch) | |
tree | ae8f85c111fff043a52932b19dd69244395f45c1 /tests/PHPUnit/bootstrap.php | |
parent | 518fcb3daee432d6ce76ee9e5d166e7c1ce67889 (diff) |
update database test work without section set (#18151)
* update database test
update database test
* update tests
update tests
* add matomo_tests to exception
add matomo_tests to exception
* test env on travis
test env on travis
* test database change on travis
test database change on travis
* update tests
update tests
* update test
update test
* update test database host
update test database host
* update tests
update tests
* Update bootstrap.php
update bootstrap to recreate empty test
Diffstat (limited to 'tests/PHPUnit/bootstrap.php')
-rw-r--r-- | tests/PHPUnit/bootstrap.php | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/tests/PHPUnit/bootstrap.php b/tests/PHPUnit/bootstrap.php index 17e57c7837..961627e5ac 100644 --- a/tests/PHPUnit/bootstrap.php +++ b/tests/PHPUnit/bootstrap.php @@ -31,20 +31,20 @@ if (file_exists(PIWIK_DOCUMENT_ROOT . '/bootstrap.php')) { if (!defined('PIWIK_INCLUDE_SEARCH_PATH')) { define('PIWIK_INCLUDE_SEARCH_PATH', get_include_path() - . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/vendor/bin' - . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/core' - . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/libs' - . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/plugins'); + . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/vendor/bin' + . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/core' + . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/libs' + . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/plugins'); } @ini_set('include_path', PIWIK_INCLUDE_SEARCH_PATH); @set_include_path(PIWIK_INCLUDE_SEARCH_PATH); @ini_set('memory_limit', -1); $GLOBALS['MATOMO_PLUGIN_DIRS'] = array( - array( - 'pluginsPathAbsolute' => PIWIK_INCLUDE_PATH . '/tests/resources/custompluginsdir', - 'webrootDirRelativeToMatomo' => 'tests/resources/custompluginsdir' - ), + array( + 'pluginsPathAbsolute' => PIWIK_INCLUDE_PATH . '/tests/resources/custompluginsdir', + 'webrootDirRelativeToMatomo' => 'tests/resources/custompluginsdir' + ), ); require_once PIWIK_INCLUDE_PATH . '/core/bootstrap.php'; @@ -65,14 +65,16 @@ function setPiwikDomainFromEnvVar() setPiwikDomainFromEnvVar(); // setup container for tests -function setupRootContainer() { +function setupRootContainer($enable = false) { // before running tests, delete the TestingEnvironmentVariables file, since it can indirectly mess w/ // phpunit's class loading (if a test class is loaded in bootstrap.php, phpunit can't load it from a file, // so executing the tests in a file will fail) - $vars = new TestingEnvironmentVariables(); - $vars->delete(); + if($enable) { + $vars = new TestingEnvironmentVariables(); + $vars->delete(); Environment::setGlobalEnvironmentManipulator(new TestingEnvironmentManipulator($vars)); + } $rootTestEnvironment = new \Piwik\Application\Environment(null); $rootTestEnvironment->init(); @@ -138,13 +140,14 @@ $config = Config::getInstance(); prepareServerVariables($config); prepareTestDatabaseConfig($config); +setupRootContainer(true); checkPiwikSetupForTests(); printTestDoxHint(); function checkPiwikSetupForTests() { if (empty($_SERVER['REQUEST_URI']) - || $_SERVER['REQUEST_URI'] == '@REQUEST_URI@' + || $_SERVER['REQUEST_URI'] == '@REQUEST_URI@' ) { echo "WARNING: for tests to pass, you must first: 1) Install webserver on localhost, eg. apache @@ -165,4 +168,4 @@ Try again."; function printTestDoxHint() { print "\nIf these tests time out consistently, it can be helpful to temporarily set testdox=true in the phpunit.xml.dist in order to see which test is causing the issue.\n"; -}
\ No newline at end of file +} |