From 34fa04f8656b542be43a48a29c25b7a6d3470c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 23 Aug 2012 09:09:15 +0200 Subject: [PATCH 01/10] Fix mixed up expected/actual params --- test/libraries/PMA_operations_test.php | 40 +++++++++++++------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/test/libraries/PMA_operations_test.php b/test/libraries/PMA_operations_test.php index bea8d2d5ca..d916c968d4 100644 --- a/test/libraries/PMA_operations_test.php +++ b/test/libraries/PMA_operations_test.php @@ -26,8 +26,8 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase $_SESSION[' PMA_token '] = 'token'; $GLOBALS['cfg']['PropertiesIconic'] = true; $this->assertEquals( - PMA_getHtmlForDatabaseComment("pma"), - '
Database comment:
' + '
Database comment:
', + PMA_getHtmlForDatabaseComment("pma") ); } @@ -39,9 +39,9 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase $_REQUEST['db_collation'] = 'db1'; $GLOBALS['cfg']['PropertiesIconic'] = true; $this->assertEquals( - PMA_getHtmlForRenameDatabase("pma"), '
-
Rename database to:
' +
Rename database to:
', + PMA_getHtmlForRenameDatabase("pma") ); } @@ -52,8 +52,8 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase $GLOBALS['cfg']['PropertiesIconic'] = true; $this->assertEquals( - PMA_getHtmlForDropDatabaseLink("pma"), - '
Remove database
' + '
Remove database
', + PMA_getHtmlForDropDatabaseLink("pma") ); } @@ -65,7 +65,6 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase $_REQUEST['db_collation'] = 'db1'; $GLOBALS['cfg']['PropertiesIconic'] = true; $this->assertEquals( - PMA_getHtmlForCopyDatabase("pma"), '
Copy database to:
@@ -74,7 +73,8 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase

-



' +



', + PMA_getHtmlForCopyDatabase("pma") ); } @@ -86,14 +86,14 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase $_REQUEST['db_collation'] = 'db1'; $GLOBALS['cfg']['PropertiesIconic'] = true; $this->assertEquals( - PMA_getHtmlForChangeDatabaseCharset("pma", "bookmark"), '
-' +', + PMA_getHtmlForChangeDatabaseCharset("pma", "bookmark") ); } @@ -104,8 +104,8 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase $GLOBALS['cfg']['PropertiesIconic'] = true; $this->assertEquals( - PMA_getHtmlForExportRelationalSchemaView("id=001&name=pma"), - '
Edit or export relational schema
' + '
Edit or export relational schema
', + PMA_getHtmlForExportRelationalSchemaView("id=001&name=pma") ); } @@ -115,10 +115,10 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase public function testPMA_getHtmlForOrderTheTable(){ $this->assertEquals( - PMA_getHtmlForOrderTheTable(array("column1", "column2")), '
Alter table order by (singly)
' + (singly)
', + PMA_getHtmlForOrderTheTable(array("column1", "column2")) ); } @@ -128,8 +128,8 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase public function testPMA_getHtmlForTableRow(){ $this->assertEquals( - PMA_getHtmlForTableRow("name", "lable", "value"), - '' + '', + PMA_getHtmlForTableRow("name", "lable", "value") ); } @@ -139,8 +139,8 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase public function testPMA_getMaintainActionlink(){ $this->assertEquals( - PMA_getMaintainActionlink("post", array("name", "value"), "lable", "value"), - '
  • postDocumentation
  • ' + '
  • postDocumentation
  • ', + PMA_getMaintainActionlink("post", array("name", "value"), "lable", "value") ); } @@ -150,8 +150,8 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase public function testPMA_getHtmlForDeleteDataOrTable(){ $this->assertEquals( - PMA_getHtmlForDeleteDataOrTable(array("truncate"), array("drop")), - '
    Delete data or table
    ' + '
    Delete data or table
    ', + PMA_getHtmlForDeleteDataOrTable(array("truncate"), array("drop")) ); } From 520b307b6f1d5e46798cdf6d1074bfd6ff804edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 23 Aug 2012 09:09:35 +0200 Subject: [PATCH 02/10] Add missing space --- test/libraries/PMA_operations_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/libraries/PMA_operations_test.php b/test/libraries/PMA_operations_test.php index d916c968d4..16565642f8 100644 --- a/test/libraries/PMA_operations_test.php +++ b/test/libraries/PMA_operations_test.php @@ -128,7 +128,7 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase public function testPMA_getHtmlForTableRow(){ $this->assertEquals( - '', + '', PMA_getHtmlForTableRow("name", "lable", "value") ); } From e2b8d630e2ac84950726beb44221b9efeb52b54d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 23 Aug 2012 09:11:41 +0200 Subject: [PATCH 03/10] Define some required params --- test/libraries/PMA_operations_test.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/libraries/PMA_operations_test.php b/test/libraries/PMA_operations_test.php index 16565642f8..c2bc3dd602 100644 --- a/test/libraries/PMA_operations_test.php +++ b/test/libraries/PMA_operations_test.php @@ -15,9 +15,32 @@ require_once 'libraries/url_generating.lib.php'; require_once 'libraries/php-gettext/gettext.inc'; require_once 'libraries/relation.lib.php'; require_once 'libraries/CommonFunctions.class.php'; +require_once 'libraries/Theme.class.php'; class PMA_operations_test extends PHPUnit_Framework_TestCase { + /** + * Set up global environment. + */ + public function setup() { + $GLOBALS['table'] = 'table'; + $GLOBALS['db'] = 'db'; + $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme'); + $GLOBALS['cfg'] = array('MySQLManualType' => 'viewable', 'AjaxEnable' => true); + + if (! function_exists('PMA_generateCharsetDropdownBox')) { + function PMA_generateCharsetDropdownBox() + { + } + } + if (! defined('PMA_CSDROPDOWN_CHARSET')) { + define('PMA_CSDROPDOWN_CHARSET', ''); + } + if (! defined('PMA_CSDROPDOWN_COLLATION')) { + define('PMA_CSDROPDOWN_COLLATION', ''); + } + } + /** * Test for PMA_getHtmlForDatabaseComment */ From 735e9f3c34015415aacd5e452ef17ab6252a4594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 23 Aug 2012 09:17:26 +0200 Subject: [PATCH 04/10] Pass correct parameters to tested functions --- test/libraries/PMA_operations_test.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/libraries/PMA_operations_test.php b/test/libraries/PMA_operations_test.php index c2bc3dd602..6fd3a856a7 100644 --- a/test/libraries/PMA_operations_test.php +++ b/test/libraries/PMA_operations_test.php @@ -141,7 +141,7 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase '
    Alter table order by (singly)
    ', - PMA_getHtmlForOrderTheTable(array("column1", "column2")) + PMA_getHtmlForOrderTheTable(array(array('Field' => "column1"), array('Field' => "column2"))) ); } @@ -163,7 +163,7 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase $this->assertEquals( '
  • postDocumentation
  • ', - PMA_getMaintainActionlink("post", array("name", "value"), "lable", "value") + PMA_getMaintainActionlink("post", array("name" => 'foo', "value" => 'bar'), array(), 'doclink') ); } @@ -220,7 +220,7 @@ class PMA_operations_test extends PHPUnit_Framework_TestCase public function testPMA_getHtmlForReferentialIntegrityCheck(){ $this->assertEquals( - PMA_getHtmlForReferentialIntegrityCheck(array("foreign1", "foreign2"), array("param1", "param2")), + PMA_getHtmlForReferentialIntegrityCheck(array(array('foreign_table' => "foreign1", 'foreign_field' => "foreign2")), array("param1" => 'a', "param2" => 'b')), '
    Check referential integrity:
    ' From 3ff66459a4dddbfdd0378a949ba3b37864f76ec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 23 Aug 2012 09:25:50 +0200 Subject: [PATCH 05/10] Gettext makes no sense here --- libraries/operations.lib.php | 2 +- libraries/server_privileges.lib.php | 76 ++++++++++++++--------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/libraries/operations.lib.php b/libraries/operations.lib.php index 5e59f27209..7549be3c2b 100644 --- a/libraries/operations.lib.php +++ b/libraries/operations.lib.php @@ -1219,7 +1219,7 @@ function PMA_getMaintainActionlink($action, $params, $url_params, $link, . '' - . __($action) + . $action . '' . PMA_CommonFunctions::getInstance()->showMySQLDocu($chapter, $link) . ''; diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index 72c89a560e..61aad636fa 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -312,12 +312,12 @@ function PMA_getHtmlForDisplayColumnPrivileges($columns, $row, $name_for_select, foreach ($columns as $current_column => $current_column_privileges) { $html_output .= '