diff --git a/test/classes/BrowseForeignersTest.php b/test/classes/BrowseForeignersTest.php index af6cc9ddee..1c3ce549bd 100644 --- a/test/classes/BrowseForeignersTest.php +++ b/test/classes/BrowseForeignersTest.php @@ -22,9 +22,12 @@ class BrowseForeignersTest extends TestCase * * @return void */ - public function setup() + public function setUp() { + $GLOBALS['cfg']['LimitChars'] = 50; $GLOBALS['cfg']['MaxRows'] = 25; + $GLOBALS['cfg']['RepeatCells'] = 100; + $GLOBALS['cfg']['ShowAll'] = false; $GLOBALS['pmaThemeImage'] = ''; } diff --git a/test/classes/CoreTest.php b/test/classes/CoreTest.php index e6e00786b9..7a04cf763c 100644 --- a/test/classes/CoreTest.php +++ b/test/classes/CoreTest.php @@ -39,6 +39,19 @@ class CoreTest extends PmaTestCase 'user_password.php', ); + /** + * Setup for test cases + * + * @return void + */ + public function setUp() + { + $GLOBALS['server'] = 0; + $GLOBALS['db'] = ''; + $GLOBALS['table'] = ''; + $GLOBALS['PMA_PHP_SELF'] = 'http://example.net/'; + } + /** * Test for Core::arrayRead * diff --git a/test/classes/DatabaseInterfaceTest.php b/test/classes/DatabaseInterfaceTest.php index 35b236d407..134b431cd0 100644 --- a/test/classes/DatabaseInterfaceTest.php +++ b/test/classes/DatabaseInterfaceTest.php @@ -26,8 +26,9 @@ class DatabaseInterfaceTest extends PmaTestCase * * @return void */ - function setup() + protected function setUp() { + $GLOBALS['server'] = 0; $extension = new DbiDummy(); $this->_dbi = new DatabaseInterface($extension); } diff --git a/test/classes/EncodingTest.php b/test/classes/EncodingTest.php index fd67b8223c..b66e2830c9 100644 --- a/test/classes/EncodingTest.php +++ b/test/classes/EncodingTest.php @@ -204,6 +204,7 @@ class EncodingTest extends TestCase public function testListEncodings() { + $GLOBALS['cfg']['AvailableCharsets'] = ['utf-8']; $result = Encoding::listEncodings(); $this->assertContains('utf-8', $result); } diff --git a/test/classes/FooterTest.php b/test/classes/FooterTest.php index 8eef4a75ed..76704d9e36 100644 --- a/test/classes/FooterTest.php +++ b/test/classes/FooterTest.php @@ -47,6 +47,7 @@ class FooterTest extends PmaTestCase $GLOBALS['text_dir'] = 'ltr'; $GLOBALS['PMA_Config'] = new Config(); $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['cfg']['Server']['verbose'] = 'verbose host'; $GLOBALS['server'] = '1'; $_GET['reload_left_frame'] = '1'; @@ -56,7 +57,6 @@ class FooterTest extends PmaTestCase unset($GLOBALS['sql_query']); $GLOBALS['error_handler'] = new ErrorHandler(); unset($_POST); - } /** diff --git a/test/classes/InsertEditTest.php b/test/classes/InsertEditTest.php index a3bbd926e4..d83682b6cb 100644 --- a/test/classes/InsertEditTest.php +++ b/test/classes/InsertEditTest.php @@ -2297,6 +2297,7 @@ class InsertEditTest extends TestCase $edited_values = array( array('c' => 'cname') ); + $GLOBALS['cfg']['DefaultTransformations']['PreApPend'] = ['', '']; $GLOBALS['cfg']['ServerDefault'] = 1; $_REQUEST['where_clause'] = 1; $transformation = array( diff --git a/test/classes/NormalizationTest.php b/test/classes/NormalizationTest.php index 74ddd748c5..cc27e26b9d 100644 --- a/test/classes/NormalizationTest.php +++ b/test/classes/NormalizationTest.php @@ -120,6 +120,9 @@ class NormalizationTest extends TestCase */ public function testPMAGetHtmlForCreateNewColumn() { + $GLOBALS['cfg']['BrowseMIME'] = true; + $GLOBALS['cfg']['MaxRows'] = 25; + $GLOBALS['col_priv'] = false; $db = "PMA_db"; $table= "PMA_table"; $num_fields = 1; diff --git a/test/classes/OperationsTest.php b/test/classes/OperationsTest.php index 5370c740e3..5498cfa93b 100644 --- a/test/classes/OperationsTest.php +++ b/test/classes/OperationsTest.php @@ -40,6 +40,7 @@ class OperationsTest extends TestCase $GLOBALS['col_priv'] = true; $GLOBALS['proc_priv'] = true; $GLOBALS['flush_priv'] = true; + $GLOBALS['is_reload_priv'] = false; $GLOBALS['cfg']['Server']['DisableIS'] = false; } diff --git a/test/classes/SqlTest.php b/test/classes/SqlTest.php index ebdb42da32..680f92a950 100644 --- a/test/classes/SqlTest.php +++ b/test/classes/SqlTest.php @@ -18,6 +18,30 @@ use stdClass; */ class SqlTest extends TestCase { + /** + * Setup for test cases + * + * @return void + */ + protected function setUp() + { + $GLOBALS['server'] = 1; + $GLOBALS['db'] = 'db'; + $GLOBALS['table'] = 'table'; + $GLOBALS['cfg']['AllowThirdPartyFraming'] = false; + $GLOBALS['cfg']['SendErrorReports'] = 'ask'; + $GLOBALS['cfg']['ServerDefault'] = 1; + $GLOBALS['cfg']['DefaultTabDatabase'] = 'structure'; + $GLOBALS['cfg']['DefaultTabTable'] = 'browse'; + $GLOBALS['cfg']['ShowDatabasesNavigationAsTree'] = true; + $GLOBALS['cfg']['NavigationTreeDefaultTabTable'] = 'structure'; + $GLOBALS['cfg']['NavigationTreeDefaultTabTable2'] = ''; + $GLOBALS['cfg']['LimitChars'] = 50; + $GLOBALS['cfg']['Confirm'] = true; + $GLOBALS['cfg']['LoginCookieValidity'] = 1440; + $GLOBALS['PMA_PHP_SELF'] = 'index.php'; + } + /** * Test Sql::getSqlWithLimitClause * @@ -28,7 +52,6 @@ class SqlTest extends TestCase // Test environment. $GLOBALS['_SESSION']['tmpval']['pos'] = 1; $GLOBALS['_SESSION']['tmpval']['max_rows'] = 2; - $GLOBALS['db'] = 'db'; $analyzed_sql_results = Sql::parseAndAnalyze( 'SELECT * FROM test LIMIT 0, 10' @@ -48,7 +71,6 @@ class SqlTest extends TestCase { // Test environment. $GLOBALS['cfg']['RememberSorting'] = true; - $GLOBALS['db'] = 'db'; $this->assertTrue( Sql::isRememberSortingOrder( @@ -90,7 +112,6 @@ class SqlTest extends TestCase { // Test environment. $GLOBALS['_SESSION']['tmpval']['max_rows'] = 10; - $GLOBALS['db'] = 'db'; $this->assertTrue( Sql::isAppendLimitClause( @@ -114,7 +135,6 @@ class SqlTest extends TestCase { // Test environment. $GLOBALS['_SESSION']['tmpval']['max_rows'] = 10; - $GLOBALS['db'] = 'db'; $this->assertTrue( Sql::isJustBrowsing( diff --git a/test/classes/TwoFactorTest.php b/test/classes/TwoFactorTest.php index 398a014cee..89d7d01c05 100644 --- a/test/classes/TwoFactorTest.php +++ b/test/classes/TwoFactorTest.php @@ -21,6 +21,9 @@ class TwoFactorTest extends PmaTestCase public function setUp() { $GLOBALS['server'] = 1; + $GLOBALS['db'] = 'db'; + $GLOBALS['table'] = 'table'; + $GLOBALS['PMA_PHP_SELF'] = 'index.php'; } /** diff --git a/test/classes/UserPreferencesTest.php b/test/classes/UserPreferencesTest.php index d3cd41d470..accca518d5 100644 --- a/test/classes/UserPreferencesTest.php +++ b/test/classes/UserPreferencesTest.php @@ -353,6 +353,8 @@ class UserPreferencesTest extends PmaTestCase public function testUserprefsRedirect() { $GLOBALS['lang'] = ''; + $GLOBALS['db'] = 'db'; + $GLOBALS['table'] = 'table'; $this->mockResponse('Location: /phpmyadmin/file.html?a=b&saved=1&server=0#h+ash'); diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php index 95a691bb52..19dfde7abf 100644 --- a/test/classes/UtilTest.php +++ b/test/classes/UtilTest.php @@ -495,10 +495,14 @@ class UtilTest extends PmaTestCase function testCheckParameterMissing() { $GLOBALS['PMA_Config'] = new Config(); - $GLOBALS['cfg'] = array('ServerDefault' => 1); $GLOBALS['text_dir'] = 'ltr'; $GLOBALS['PMA_PHP_SELF'] = Core::getenv('PHP_SELF'); $GLOBALS['pmaThemePath'] = $GLOBALS['PMA_Theme']->getPath(); + $GLOBALS['db'] = 'db'; + $GLOBALS['table'] = 'table'; + $GLOBALS['server'] = 1; + $GLOBALS['cfg']['ServerDefault'] = 1; + $GLOBALS['cfg']['AllowThirdPartyFraming'] = false; $this->expectOutputRegex("/Missing parameter: field/");