Skip to content

Commit

Permalink
Move PMA_VERSION calls into defineVersionConstants() for tests
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed May 21, 2020
1 parent f89f4c9 commit fe32a35
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
8 changes: 0 additions & 8 deletions test/bootstrap-dist.php
Expand Up @@ -77,13 +77,5 @@
$GLOBALS['PMA_Config']->set('environment', 'development');
$GLOBALS['cfg']['environment'] = 'development';

// Initialize PMA_VERSION variable
// phpcs:disable PSR1.Files.SideEffects
if (! defined('PMA_VERSION')) {
define('PMA_VERSION', $GLOBALS['PMA_Config']->get('PMA_VERSION'));
define('PMA_MAJOR_VERSION', $GLOBALS['PMA_Config']->get('PMA_MAJOR_VERSION'));
}
// phpcs:enable

/* Load Database interface */
$GLOBALS['dbi'] = DatabaseInterface::load(new DbiDummy());
12 changes: 12 additions & 0 deletions test/classes/AbstractTestCase.php
Expand Up @@ -125,6 +125,18 @@ protected function setProxySettings(): void
// phpcs:enable
}

protected function defineVersionConstants(): void
{
global $PMA_Config;
// Initialize PMA_VERSION variable
// phpcs:disable PSR1.Files.SideEffects
if (! defined('PMA_VERSION')) {
define('PMA_VERSION', $PMA_Config->get('PMA_VERSION'));
define('PMA_MAJOR_VERSION', $PMA_Config->get('PMA_MAJOR_VERSION'));
}
// phpcs:enable
}

/**
* Desctroys the environment built for the test.
* Clean all variables
Expand Down
1 change: 1 addition & 0 deletions test/classes/BookmarkTest.php
Expand Up @@ -23,6 +23,7 @@ class BookmarkTest extends AbstractTestCase
protected function setUp(): void
{
parent::setUp();
parent::defineVersionConstants();
$GLOBALS['cfg']['Server']['user'] = 'root';
$GLOBALS['cfg']['Server']['pmadb'] = 'phpmyadmin';
$GLOBALS['cfg']['Server']['bookmarktable'] = 'pma_bookmark';
Expand Down
1 change: 1 addition & 0 deletions test/classes/CentralColumnsTest.php
Expand Up @@ -96,6 +96,7 @@ protected function setUp(): void
{
parent::setUp();
parent::setGlobalConfig();
parent::defineVersionConstants();
$GLOBALS['cfg']['Server']['user'] = 'pma_user';
$GLOBALS['cfg']['Server']['DisableIS'] = true;
$GLOBALS['cfg']['MaxRows'] = 10;
Expand Down
1 change: 1 addition & 0 deletions test/classes/Config/FormDisplayTest.php
Expand Up @@ -33,6 +33,7 @@ protected function setUp(): void
parent::setUp();
parent::setTheme();
parent::loadDefaultConfig();
parent::defineVersionConstants();
$GLOBALS['pmaThemePath'] = $GLOBALS['PMA_Theme']->getPath();
parent::setGlobalConfig();
$GLOBALS['server'] = 0;
Expand Down
1 change: 1 addition & 0 deletions test/classes/Config/FormTest.php
Expand Up @@ -31,6 +31,7 @@ protected function setUp(): void
parent::setUp();
parent::setTheme();
parent::loadDefaultConfig();
parent::defineVersionConstants();
$GLOBALS['pmaThemePath'] = $GLOBALS['PMA_Theme']->getPath();
parent::setGlobalConfig();
$GLOBALS['server'] = 0;
Expand Down

0 comments on commit fe32a35

Please sign in to comment.