From ce278386d90695df94a88637693d5f1f796baf67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Mon, 18 Dec 2017 16:57:04 -0200 Subject: [PATCH 01/12] Fix BrowseForeignersTest global dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- test/classes/BrowseForeignersTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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'] = ''; } From 89316d3ed5de20bdcc52622310a051b1802a9244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Mon, 18 Dec 2017 17:10:55 -0200 Subject: [PATCH 02/12] Fix CoreTest global dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- test/classes/CoreTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 * From f24d3fa8cd6be0e190669b524a05d4f10775c041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Mon, 18 Dec 2017 17:15:40 -0200 Subject: [PATCH 03/12] Fix DatabaseInterfaceTest global dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- test/classes/DatabaseInterfaceTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); } From ca376e4d76633aa3357157cf6a2aa3c524481a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Mon, 18 Dec 2017 17:32:23 -0200 Subject: [PATCH 04/12] Fix EncodingTest global dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- test/classes/EncodingTest.php | 1 + 1 file changed, 1 insertion(+) 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); } From 3cf80a7984f1978a88585e29e584294cc955b681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Mon, 18 Dec 2017 23:43:45 -0200 Subject: [PATCH 05/12] Fix FooterTest global dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- test/classes/FooterTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); - } /** From 12eb63fab0c61e41ad7ae49a5c4ae8340714d1bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Mon, 18 Dec 2017 23:52:27 -0200 Subject: [PATCH 06/12] Fix InsertEditTest global dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- test/classes/InsertEditTest.php | 1 + 1 file changed, 1 insertion(+) 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( From f071ed04446cbc77144e8b7d64e18e6906d2ef92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Tue, 19 Dec 2017 00:07:43 -0200 Subject: [PATCH 07/12] Fix NormalizationTest global dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- test/classes/NormalizationTest.php | 3 +++ 1 file changed, 3 insertions(+) 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; From 7863bdedf553d96557014dbfaab41789e702955c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Tue, 19 Dec 2017 00:10:37 -0200 Subject: [PATCH 08/12] Fix OperationsTest global dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- test/classes/OperationsTest.php | 1 + 1 file changed, 1 insertion(+) 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; } From 518398538724e9d6c86fd35ba85aca3b5dc72c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Tue, 19 Dec 2017 00:34:19 -0200 Subject: [PATCH 09/12] Fix SqlTest global dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- test/classes/SqlTest.php | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) 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( From baddbaca402c401341ef990b59083e7c07d94b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Tue, 19 Dec 2017 00:39:17 -0200 Subject: [PATCH 10/12] Fix TwoFactorTest global dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- test/classes/TwoFactorTest.php | 3 +++ 1 file changed, 3 insertions(+) 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'; } /** From aedbf04970dd36597d22ec6fdea5cc827bee3446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Tue, 19 Dec 2017 00:42:04 -0200 Subject: [PATCH 11/12] Fix UserPreferencesTest global dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- test/classes/UserPreferencesTest.php | 2 ++ 1 file changed, 2 insertions(+) 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'); From 79ac8148053aac861438ca26d32f6ccee896920c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Tue, 19 Dec 2017 01:01:28 -0200 Subject: [PATCH 12/12] Fix UtilTest global dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- test/classes/UtilTest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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/");