Git
Threads by month
- ----- 2025 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 11 participants
- 38616 discussions

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-11001-gb857e95
by Michal Čihař 20 Jul '11
by Michal Čihař 20 Jul '11
20 Jul '11
The branch, master has been updated
via b857e9580757a84132fc8ccd820a549115af7e2d (commit)
from fc387fe531b6ca1e95f3ba1ad6fbcc499e0f2ccf (commit)
- Log -----------------------------------------------------------------
commit b857e9580757a84132fc8ccd820a549115af7e2d
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Wed Jul 20 15:20:59 2011 +0200
Avoid using overrides for jquery CSS
It is better to modify the style itself instead of including another
tiny file with changes.
-----------------------------------------------------------------------
Summary of changes:
libraries/header_meta_style.inc.php | 7 -------
themes/original/jquery/jquery-ui-1.8.custom.css | 6 ++++--
themes/original/jquery/jquery-ui-1.8.override.css | 8 --------
themes/pmahomme/jquery/jquery-ui-1.8.custom.css | 6 ++++--
themes/pmahomme/jquery/jquery-ui-1.8.override.css | 8 --------
5 files changed, 8 insertions(+), 27 deletions(-)
delete mode 100644 themes/original/jquery/jquery-ui-1.8.override.css
delete mode 100644 themes/pmahomme/jquery/jquery-ui-1.8.override.css
diff --git a/libraries/header_meta_style.inc.php b/libraries/header_meta_style.inc.php
index e78b653..5e5c533 100644
--- a/libraries/header_meta_style.inc.php
+++ b/libraries/header_meta_style.inc.php
@@ -48,11 +48,4 @@ if ($GLOBALS['text_dir'] == 'ltr') {
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>phpmyadmin.css.php<?php echo PMA_generate_common_url(array('server' => $GLOBALS['server'])); ?>&js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>print.css" media="print" />
<link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['pmaThemePath']; ?>/jquery/jquery-ui-1.8.custom.css" />
-<?php
- if (is_readable($GLOBALS['pmaThemePath'] . '/jquery/jquery-ui-1.8.override.css')) {
-?>
- <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['pmaThemePath']; ?>/jquery/jquery-ui-1.8.override.css" />
-<?php
- }
-?>
<meta name="robots" content="noindex,nofollow" />
diff --git a/themes/original/jquery/jquery-ui-1.8.custom.css b/themes/original/jquery/jquery-ui-1.8.custom.css
index bc1fb0e..edcb8e6 100644
--- a/themes/original/jquery/jquery-ui-1.8.custom.css
+++ b/themes/original/jquery/jquery-ui-1.8.custom.css
@@ -47,7 +47,7 @@
/* Component containers
----------------------------------*/
-.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
+.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
@@ -485,4 +485,6 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
}/* Progressbar
----------------------------------*/
.ui-progressbar { height:2em; text-align: left; }
-.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
\ No newline at end of file
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
+/* Timepicker */
+#ui-timepicker-div { z-index: 1003; }
diff --git a/themes/original/jquery/jquery-ui-1.8.override.css b/themes/original/jquery/jquery-ui-1.8.override.css
deleted file mode 100644
index 2835781..0000000
--- a/themes/original/jquery/jquery-ui-1.8.override.css
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Use this file to override styles set by jquery-ui-1.8.custom.css
- */
-
-/* Component containers
-----------------------------------*/
-.ui-widget { font-size: 1em; }
-#ui-timepicker-div { z-index: 1003; }
diff --git a/themes/pmahomme/jquery/jquery-ui-1.8.custom.css b/themes/pmahomme/jquery/jquery-ui-1.8.custom.css
index a350461..ca2b44b 100644
--- a/themes/pmahomme/jquery/jquery-ui-1.8.custom.css
+++ b/themes/pmahomme/jquery/jquery-ui-1.8.custom.css
@@ -47,7 +47,7 @@
/* Component containers
----------------------------------*/
-.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
+.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
@@ -485,4 +485,6 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
}/* Progressbar
----------------------------------*/
.ui-progressbar { height:2em; text-align: left; }
-.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
\ No newline at end of file
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
+/* Timepicker */
+#ui-timepicker-div { z-index: 1003; }
diff --git a/themes/pmahomme/jquery/jquery-ui-1.8.override.css b/themes/pmahomme/jquery/jquery-ui-1.8.override.css
deleted file mode 100644
index 2835781..0000000
--- a/themes/pmahomme/jquery/jquery-ui-1.8.override.css
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Use this file to override styles set by jquery-ui-1.8.custom.css
- */
-
-/* Component containers
-----------------------------------*/
-.ui-widget { font-size: 1em; }
-#ui-timepicker-div { z-index: 1003; }
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-11000-gfc387fe
by Michal Čihař 20 Jul '11
by Michal Čihař 20 Jul '11
20 Jul '11
The branch, master has been updated
via fc387fe531b6ca1e95f3ba1ad6fbcc499e0f2ccf (commit)
from fbc2bbdc49865d8dc39f80e0ea70e5d26da39ec7 (commit)
- Log -----------------------------------------------------------------
commit fc387fe531b6ca1e95f3ba1ad6fbcc499e0f2ccf
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Wed Jul 20 15:10:20 2011 +0200
Load codemirror only when needed
This needs verification with ajax requests.
-----------------------------------------------------------------------
Summary of changes:
db_events.php | 2 ++
db_routines.php | 2 ++
db_sql.php | 2 ++
db_triggers.php | 2 ++
libraries/header_scripts.inc.php | 2 --
server_sql.php | 2 ++
tbl_sql.php | 2 ++
7 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/db_events.php b/db_events.php
index c4397e7..9991f83 100644
--- a/db_events.php
+++ b/db_events.php
@@ -19,6 +19,8 @@ $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
$GLOBALS['js_include'][] = 'jquery/timepicker.js';
$GLOBALS['js_include'][] = 'rte/common.js';
$GLOBALS['js_include'][] = 'rte/events.js';
+$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
+$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
/**
* Include all other files
diff --git a/db_routines.php b/db_routines.php
index 739e69a..745d1f9 100644
--- a/db_routines.php
+++ b/db_routines.php
@@ -21,6 +21,8 @@ $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
$GLOBALS['js_include'][] = 'jquery/timepicker.js';
$GLOBALS['js_include'][] = 'rte/common.js';
$GLOBALS['js_include'][] = 'rte/routines.js';
+$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
+$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
/**
* Include all other files
diff --git a/db_sql.php b/db_sql.php
index 26a6299..38074e9 100644
--- a/db_sql.php
+++ b/db_sql.php
@@ -16,6 +16,8 @@ require_once './libraries/common.inc.php';
$GLOBALS['js_include'][] = 'functions.js';
$GLOBALS['js_include'][] = 'makegrid.js';
$GLOBALS['js_include'][] = 'sql.js';
+$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
+$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
require './libraries/db_common.inc.php';
require_once './libraries/sql_query_form.lib.php';
diff --git a/db_triggers.php b/db_triggers.php
index aef1642..4911f36 100644
--- a/db_triggers.php
+++ b/db_triggers.php
@@ -18,6 +18,8 @@ require_once './libraries/common.lib.php';
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
$GLOBALS['js_include'][] = 'rte/common.js';
$GLOBALS['js_include'][] = 'rte/triggers.js';
+$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
+$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
/**
* Include all other files
diff --git a/libraries/header_scripts.inc.php b/libraries/header_scripts.inc.php
index 2e0a9ca..c25aa99 100644
--- a/libraries/header_scripts.inc.php
+++ b/libraries/header_scripts.inc.php
@@ -39,8 +39,6 @@ if (isset($GLOBALS['db'])) {
$params['db'] = $GLOBALS['db'];
}
$GLOBALS['js_include'][] = 'messages.php' . PMA_generate_common_url($params);
-$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
-$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
/**
* Here we add a timestamp when loading the file, so that users who
diff --git a/server_sql.php b/server_sql.php
index f8609f4..ddf90ed 100644
--- a/server_sql.php
+++ b/server_sql.php
@@ -16,6 +16,8 @@ require_once './libraries/common.inc.php';
$GLOBALS['js_include'][] = 'functions.js';
$GLOBALS['js_include'][] = 'makegrid.js';
$GLOBALS['js_include'][] = 'sql.js';
+$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
+$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
require_once './libraries/server_common.inc.php';
require_once './libraries/sql_query_form.lib.php';
diff --git a/tbl_sql.php b/tbl_sql.php
index 0321395..70f2177 100644
--- a/tbl_sql.php
+++ b/tbl_sql.php
@@ -16,6 +16,8 @@ require_once './libraries/common.inc.php';
$GLOBALS['js_include'][] = 'functions.js';
$GLOBALS['js_include'][] = 'makegrid.js';
$GLOBALS['js_include'][] = 'sql.js';
+$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
+$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
require './libraries/tbl_common.php';
$url_query .= '&goto=tbl_sql.php&back=tbl_sql.php';
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-10999-gfbc2bbd
by Michal Čihař 20 Jul '11
by Michal Čihař 20 Jul '11
20 Jul '11
The branch, master has been updated
via fbc2bbdc49865d8dc39f80e0ea70e5d26da39ec7 (commit)
from ed66e5c66843eb77364e7ecb8ef2495791b8605f (commit)
- Log -----------------------------------------------------------------
commit fbc2bbdc49865d8dc39f80e0ea70e5d26da39ec7
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Wed Jul 20 15:04:52 2011 +0200
Unlock session while serving JS messages
-----------------------------------------------------------------------
Summary of changes:
js/messages.php | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/js/messages.php b/js/messages.php
index 2ab89dd..1345a8e 100644
--- a/js/messages.php
+++ b/js/messages.php
@@ -19,6 +19,8 @@ header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600) . ' GMT');
// non-js-compatible stuff like DOCTYPE
define('PMA_MINIMUM_COMMON', true);
require_once './libraries/common.inc.php';
+// Close session early as we won't write anything there
+session_write_close();
// But this one is needed for PMA_escapeJsString()
require_once './libraries/js_escape.lib.php';
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-10998-ged66e5c
by Michal Čihař 20 Jul '11
by Michal Čihař 20 Jul '11
20 Jul '11
The branch, master has been updated
via ed66e5c66843eb77364e7ecb8ef2495791b8605f (commit)
via 5d551c48b74fbc470d777e673df9a7eb2a995a88 (commit)
via 42d3af654d91e733bade25b68cfd940783519f23 (commit)
via 079851a6d5a9247011c9afa140b074229871542c (commit)
via c18f64ef6a5accba82a066ce6c4aafa1afcee93b (commit)
via 91491de2474f2a5f3a832126f04f16bb7e6e9807 (commit)
via 80a002ee474bfaf56c7ba58faa07434eb06074dc (commit)
via 709502f302fb4ea00fa5874778bc74e37f12ef52 (commit)
via 8bbc30f3c0eba04bfee0cfb1d097bbc796549c03 (commit)
via dfda93c81af605dc5ed4bd16efa00593341ba22c (commit)
via 27d114672d8c944ffff6ad4ca02353db5b9d2719 (commit)
via b006ec18015942e99dc51e1cff6b4bccc50078d7 (commit)
via 15a53daa189804d229f2ca0923005e64b9dc376d (commit)
via 5a4d09d2299d8c3c76a3420020e9207324208fcf (commit)
via 06b3b36c9bbd8a128096a80be0fbb7fa6e92a228 (commit)
via 9657ebd16f62e1cacbe4674eeaa809966493a5c0 (commit)
via 5d3dc3074434fb08f254c0e8fd5b59b65b878548 (commit)
via 878592b1d6f2a989854d0b7a7deb1b064fc15a05 (commit)
via 161bf69c49a801403a56795efe7e110e1eec323c (commit)
via e448058b382a76bd7c8d82819ec3cbe84349d74c (commit)
via ebcf5b1779223d30378f593f62ffc90a89598d59 (commit)
via f62536e7745c03290b3fb15fa40d534a41a28988 (commit)
via 44ff9c272d33725b60a108a773efb884a76f6030 (commit)
via 3629071106f6c937fc0daccdd1bdbb284e7b1a5a (commit)
via 4b67fbead637d6e809e3c51ba1d465bce1951ed9 (commit)
via 45fff3c76bd8063c0313856d1eb48d27e74eaf1b (commit)
via 292b41af7456b9fe582b243f7253bb0fc268c1a2 (commit)
via 583d174886e13c4b0954406abb3115d19325d5ca (commit)
via c71862084aaff2889a8cbac926c8c1e77912133e (commit)
via c9be59e9710322d63bac2e420011ff105f1ae410 (commit)
via cdcde8645fb293a8585f9b973dc10961214db451 (commit)
via d392f2ce2d9218843f1a33ae759eb513a25c6dcd (commit)
via 99bd192ec52e7ad19a493abd931ffe0f965f2094 (commit)
from 307bc95a180f5673756d5e6e957f9bd3f93a0be6 (commit)
- Log -----------------------------------------------------------------
commit ed66e5c66843eb77364e7ecb8ef2495791b8605f
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 12:03:48 2011 +0200
Translation update done using Pootle.
commit 5d551c48b74fbc470d777e673df9a7eb2a995a88
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 12:02:18 2011 +0200
Translation update done using Pootle.
commit 42d3af654d91e733bade25b68cfd940783519f23
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 12:01:46 2011 +0200
Translation update done using Pootle.
commit 079851a6d5a9247011c9afa140b074229871542c
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 12:01:19 2011 +0200
Translation update done using Pootle.
commit c18f64ef6a5accba82a066ce6c4aafa1afcee93b
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 12:00:27 2011 +0200
Translation update done using Pootle.
commit 91491de2474f2a5f3a832126f04f16bb7e6e9807
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 11:45:24 2011 +0200
Translation update done using Pootle.
commit 80a002ee474bfaf56c7ba58faa07434eb06074dc
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 11:35:09 2011 +0200
Translation update done using Pootle.
commit 709502f302fb4ea00fa5874778bc74e37f12ef52
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 11:25:30 2011 +0200
Translation update done using Pootle.
commit 8bbc30f3c0eba04bfee0cfb1d097bbc796549c03
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 11:23:24 2011 +0200
Translation update done using Pootle.
commit dfda93c81af605dc5ed4bd16efa00593341ba22c
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 11:21:48 2011 +0200
Translation update done using Pootle.
commit 27d114672d8c944ffff6ad4ca02353db5b9d2719
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 11:14:15 2011 +0200
Translation update done using Pootle.
commit b006ec18015942e99dc51e1cff6b4bccc50078d7
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 11:13:16 2011 +0200
Translation update done using Pootle.
commit 15a53daa189804d229f2ca0923005e64b9dc376d
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 11:06:52 2011 +0200
Translation update done using Pootle.
commit 5a4d09d2299d8c3c76a3420020e9207324208fcf
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 11:05:06 2011 +0200
Translation update done using Pootle.
commit 06b3b36c9bbd8a128096a80be0fbb7fa6e92a228
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 11:04:57 2011 +0200
Translation update done using Pootle.
commit 9657ebd16f62e1cacbe4674eeaa809966493a5c0
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 11:02:43 2011 +0200
Translation update done using Pootle.
commit 5d3dc3074434fb08f254c0e8fd5b59b65b878548
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 11:02:05 2011 +0200
Translation update done using Pootle.
commit 878592b1d6f2a989854d0b7a7deb1b064fc15a05
Author: Panagiotis Papazoglou <papaz_p(a)yahoo.com>
Date: Wed Jul 20 11:01:17 2011 +0200
Translation update done using Pootle.
commit 161bf69c49a801403a56795efe7e110e1eec323c
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 10:59:09 2011 +0200
Translation update done using Pootle.
commit e448058b382a76bd7c8d82819ec3cbe84349d74c
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 10:58:18 2011 +0200
Translation update done using Pootle.
commit ebcf5b1779223d30378f593f62ffc90a89598d59
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 10:55:16 2011 +0200
Translation update done using Pootle.
commit f62536e7745c03290b3fb15fa40d534a41a28988
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 10:54:36 2011 +0200
Translation update done using Pootle.
commit 44ff9c272d33725b60a108a773efb884a76f6030
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 10:54:19 2011 +0200
Translation update done using Pootle.
commit 3629071106f6c937fc0daccdd1bdbb284e7b1a5a
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 10:54:07 2011 +0200
Translation update done using Pootle.
commit 4b67fbead637d6e809e3c51ba1d465bce1951ed9
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 10:50:48 2011 +0200
Translation update done using Pootle.
commit 45fff3c76bd8063c0313856d1eb48d27e74eaf1b
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 10:45:46 2011 +0200
Translation update done using Pootle.
commit 292b41af7456b9fe582b243f7253bb0fc268c1a2
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 10:43:53 2011 +0200
Translation update done using Pootle.
commit 583d174886e13c4b0954406abb3115d19325d5ca
Merge: c71862084aaff2889a8cbac926c8c1e77912133e 307bc95a180f5673756d5e6e957f9bd3f93a0be6
Author: Pootle server <pootle(a)cihar.com>
Date: Wed Jul 20 10:40:06 2011 +0200
Merge remote-tracking branch 'origin/master'
commit c71862084aaff2889a8cbac926c8c1e77912133e
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 10:36:26 2011 +0200
Translation update done using Pootle.
commit c9be59e9710322d63bac2e420011ff105f1ae410
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 10:36:04 2011 +0200
Translation update done using Pootle.
commit cdcde8645fb293a8585f9b973dc10961214db451
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 10:35:56 2011 +0200
Translation update done using Pootle.
commit d392f2ce2d9218843f1a33ae759eb513a25c6dcd
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 10:35:40 2011 +0200
Translation update done using Pootle.
commit 99bd192ec52e7ad19a493abd931ffe0f965f2094
Author: Yuichiro <yuichiro(a)pop07.odn.ne.jp>
Date: Wed Jul 20 10:34:57 2011 +0200
Translation update done using Pootle.
-----------------------------------------------------------------------
Summary of changes:
po/el.po | 2 +-
po/ja.po | 74 ++++++++++++++++++++++++-------------------------------------
2 files changed, 30 insertions(+), 46 deletions(-)
diff --git a/po/el.po b/po/el.po
index 4accbea..311f73a 100644
--- a/po/el.po
+++ b/po/el.po
@@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel(a)lists.sourceforge.net\n"
"POT-Creation-Date: 2011-07-19 14:25+0200\n"
-"PO-Revision-Date: 2011-07-19 21:50+0200\n"
+"PO-Revision-Date: 2011-07-20 11:01+0200\n"
"Last-Translator: Panagiotis Papazoglou <papaz_p(a)yahoo.com>\n"
"Language-Team: greek <el(a)li.org>\n"
"Language: el\n"
diff --git a/po/ja.po b/po/ja.po
index 8a4f223..bb53049 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel(a)lists.sourceforge.net\n"
"POT-Creation-Date: 2011-07-19 14:25+0200\n"
-"PO-Revision-Date: 2011-07-18 11:16+0200\n"
+"PO-Revision-Date: 2011-07-20 12:03+0200\n"
"Last-Translator: Yuichiro <yuichiro(a)pop07.odn.ne.jp>\n"
"Language-Team: japanese <jp(a)li.org>\n"
"Language: ja\n"
@@ -1138,15 +1138,15 @@ msgstr "クエリの統計"
#: js/messages.php:92
msgid "System CPU Usage"
-msgstr ""
+msgstr "システム CPU の使用状況"
#: js/messages.php:93
msgid "System memory"
-msgstr ""
+msgstr "システムメモリ"
#: js/messages.php:94
msgid "System swap"
-msgstr ""
+msgstr "システムスワップ"
#: js/messages.php:95 libraries/common.lib.php:1276 server_status.php:1385
msgid "MiB"
@@ -1158,7 +1158,7 @@ msgstr "KiB"
#: js/messages.php:98
msgid "Average load"
-msgstr ""
+msgstr "平均負荷"
#. l10n: Questions is the name of a MySQL Status variable
#: js/messages.php:100
@@ -1177,20 +1177,18 @@ msgid "Settings"
msgstr "設定"
#: js/messages.php:103
-#, fuzzy
#| msgid "Remove database"
msgid "Remove chart"
-msgstr "データベースの削除"
+msgstr "グラフの削除"
#: js/messages.php:104
msgid "Edit labels and series"
msgstr ""
#: js/messages.php:105
-#, fuzzy
#| msgid "Snap to grid"
msgid "Add chart to grid"
-msgstr "グリッドにあわせる"
+msgstr "モニタリンググラフを追加する"
#: js/messages.php:107
msgid "Please add at least one variable to the series"
@@ -1205,11 +1203,11 @@ msgstr "なし"
#: js/messages.php:109
msgid "Resume monitor"
-msgstr ""
+msgstr "モニタ再開"
#: js/messages.php:110
msgid "Pause monitor"
-msgstr ""
+msgstr "モニタ一時中断"
#: js/messages.php:112
msgid "general_log and slow_query_log is enabled."
@@ -1300,7 +1298,6 @@ msgid "Current settings"
msgstr "詳細設定"
#: js/messages.php:133 server_status.php:1345
-#, fuzzy
#| msgid "Chart title"
msgid "Chart Title"
msgstr "グラフの題名"
@@ -8996,10 +8993,9 @@ msgstr "全ての状態変数"
#: server_status.php:576
msgid "Monitor"
-msgstr ""
+msgstr "モニタ"
#: server_status.php:586 server_status.php:608
-#, fuzzy
#| msgid "Refresh rate:"
msgid "Refresh rate: "
msgstr "再描画間隔:"
@@ -9134,7 +9130,7 @@ msgstr "ID"
msgid ""
"The number of connections that were aborted because the client died without "
"closing the connection properly."
-msgstr ""
+msgstr "クライアントが適切に接続を閉じなかったために中断された接続数。"
#: server_status.php:1033
msgid "The number of failed attempts to connect to the MySQL server."
@@ -9773,10 +9769,9 @@ msgid "The number of threads that are not sleeping."
msgstr "スリープしていないスレッドの数"
#: server_status.php:1277
-#, fuzzy
#| msgid "Start row"
msgid "Start Monitor"
-msgstr "開始行"
+msgstr "モニタ開始"
#: server_status.php:1285
#, fuzzy
@@ -9786,33 +9781,30 @@ msgstr "はじめに"
#: server_status.php:1289
msgid "Done rearranging/editing charts"
-msgstr ""
+msgstr "グラフの再配置/変更完了"
#: server_status.php:1296
-#, fuzzy
#| msgid "Add parameter"
msgid "Add chart"
-msgstr "パラメータを追加する"
+msgstr "グラフの追加"
#: server_status.php:1298
msgid "Rearrange/edit charts"
-msgstr ""
+msgstr "グラフの再配置/変更"
#: server_status.php:1300
msgid "Refresh rate:"
msgstr "再描画間隔:"
#: server_status.php:1303
-#, fuzzy
#| msgid "Textarea columns"
msgid "Chart columns:"
-msgstr "textarea の 1 行の文字数"
+msgstr "1 段のグラフ数"
#: server_status.php:1317
-#, fuzzy
#| msgid "User for config auth"
msgid "Clear monitor config"
-msgstr "config 認証用のユーザ"
+msgstr "モニタ設定のクリア"
#: server_status.php:1320
#, fuzzy
@@ -9850,34 +9842,29 @@ msgid ""
msgstr ""
#: server_status.php:1348
-#, fuzzy
#| msgid "Usage"
msgid "CPU Usage"
-msgstr "使用量"
+msgstr "CPU 使用状況"
#: server_status.php:1351
-#, fuzzy
#| msgid "2. Usage"
msgid "Memory Usage"
-msgstr "2. 使い方"
+msgstr "メモリ使用状況"
#: server_status.php:1354
-#, fuzzy
#| msgid "Usage"
msgid "Swap Usage"
-msgstr "使用量"
+msgstr "スワップ状況"
#: server_status.php:1357
-#, fuzzy
#| msgid "All status variables"
msgid "Status variable(s)"
-msgstr "全ての状態変数"
+msgstr "状態変数"
#: server_status.php:1359
-#, fuzzy
#| msgid "Select Tables"
msgid "Select series:"
-msgstr "テーブルを選択してください"
+msgstr "系列の選択:"
#: server_status.php:1361
msgid "Commonly monitored"
@@ -9891,31 +9878,29 @@ msgstr "有効なテーブル名を指定してください"
#: server_status.php:1380
msgid "Display as differential value"
-msgstr ""
+msgstr "差分値として表示する"
#: server_status.php:1382
msgid "Apply a divisor"
-msgstr ""
+msgstr "除数を適用する"
#: server_status.php:1389
msgid "Append unit to data values"
-msgstr ""
+msgstr "データ値に単位を追加する"
#: server_status.php:1395
-#, fuzzy
#| msgid "Add trigger"
msgid "Add this series"
-msgstr "トリガを追加する"
+msgstr "この系列を追加する"
#: server_status.php:1397
msgid "Clear series"
-msgstr ""
+msgstr "系列をクリアする"
#: server_status.php:1400
-#, fuzzy
#| msgid "SQL queries"
msgid "Series in Chart:"
-msgstr "SQL クエリ"
+msgstr "グラフの系列"
#: server_status.php:1408
#, fuzzy
@@ -10506,10 +10491,9 @@ msgid "X-Axis:"
msgstr "横軸:"
#: tbl_chart.php:113
-#, fuzzy
#| msgid "SQL queries"
msgid "Series:"
-msgstr "SQL クエリ"
+msgstr "系列:"
#: tbl_chart.php:115
#, fuzzy
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-9567-gdd7eb38
by Herman van Rink 20 Jul '11
by Herman van Rink 20 Jul '11
20 Jul '11
The branch, master has been updated
via dd7eb38814f0ab82cbcceb011dd3252b08ee0b97 (commit)
via 9c4fd802abf2970658da427c9c642f0c5376f76d (commit)
via f787d74f1027d15f5817b4647d7d67085b9c1f3f (commit)
via 2ca6e701541f54581600fde49e92daa92335a016 (commit)
via 9c7d2bf9a72f52ab2deea8791d3dbf9723e91df3 (commit)
via 72de42f47de343611271f1a94031b0f233fee2e4 (commit)
via 285971a8cbb6a47d6abd78628ac06fb5e6ee91b0 (commit)
via c9c110969fc77ac8bb63a1e48a8c00bc86e2f7ed (commit)
via b309cf3e985f71dd0bf295a5c503e171605231d1 (commit)
via 05a79cbbf8d366a72e17e941dc52a070d296ff1b (commit)
via cf8ea68f093effa03832ef9c3a09ab0a67f2655c (commit)
via 09660a6624494f4c57771c0270e2e558bfbc43cb (commit)
via cf733f1f554ffcca3b52a8e41fadcacc5af457f1 (commit)
via f8ba1d5c738b1d717ceb5f2b25f92d44e29618dd (commit)
via 161a63a85e175a3b563846d8ffae99c9d6c07ddd (commit)
via b00f268ccae0a670693268865bf93dfbd3d71a9b (commit)
via e093653e46fd9fae6837ec3b8db94c58abd84239 (commit)
via f81c001f76af2f39cbdc15002feefaa3821676ec (commit)
via 2e93b81172585e694c8dfdb4aa41a9272b90971e (commit)
via 60a2e5b3f312adf7acbe1c9ee01c21a70f9d07cf (commit)
via fc5a9a6131f9bec3c7f8c91666f483b9487c1132 (commit)
via 91709ec0c18074299b9e8560653018a9ff9206d3 (commit)
via d17aab53e4fd3a9f45428e86864c8a985e2a0100 (commit)
via cf5d62b7ca87c463d831ad0a8c2c31aca5c0b606 (commit)
via 0c5c137403311e0e34f9ca32eea6f9f6672f4ed6 (commit)
via 7087e74c63dd4460e3dff2d8986978aa014ce23b (commit)
via e31ee99f7e1f3a2ddde3cdca06af6ab0fa437ece (commit)
via f05749656d8aad37cf52c11fc9fa5d187c3f8f8c (commit)
via 0e2e973f6c91418b26e65e639d597e56bf5cfde9 (commit)
via d8372daa55fc91ee035a07dcef83dd96d1ace837 (commit)
via 52b0206a0c910f90e298613d0037646e43045c12 (commit)
via f7d7102d2fc595f837f778fe18488251bf980229 (commit)
from 40ccdcb2366e03fa5a03c41ad9c0bbc5c60feaa0 (commit)
- Log -----------------------------------------------------------------
commit dd7eb38814f0ab82cbcceb011dd3252b08ee0b97
Author: Herman van Rink <rink(a)initfour.nl>
Date: Tue Jul 19 22:15:46 2011 +0200
cleanup, removed exrea braces
commit 9c4fd802abf2970658da427c9c642f0c5376f76d
Merge: f787d74f1027d15f5817b4647d7d67085b9c1f3f 40ccdcb2366e03fa5a03c41ad9c0bbc5c60feaa0
Author: Herman van Rink <rink(a)initfour.nl>
Date: Tue Jul 19 22:09:28 2011 +0200
Merge remote branch 'origin/master' into unittesting
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 6 +
build.xml | 87 +++
libraries/common.lib.php | 4 +-
libraries/core.lib.php | 6 +-
phpunit.xml.dist | 53 ++
test/.htaccess | 6 +
test/Environment_test.php | 28 +-
test/FailTest.php | 24 -
test/PMA_Message_test.php | 388 ----------
test/PMA_SQL_parser_data_test.php | 67 --
test/PMA_SQL_parser_test.php | 262 -------
test/PMA_STR_sub_test.php | 49 --
test/PMA_blowfish_test.php | 59 --
test/PMA_cache_test.php | 103 ---
test/PMA_escapeJsString_test.php | 57 --
test/PMA_escapeMySqlWildcards_test.php | 59 --
test/PMA_foreignKeySupported_test.php | 46 --
test/PMA_formatNumberByteDown_test.php | 112 ---
test/PMA_generateCommonUrl_test.php | 146 ----
test/PMA_get_real_size_test.php | 45 --
test/PMA_headerLocation_test.php | 304 --------
test/PMA_ifSetOr_test.php | 49 --
test/PMA_isValid_test.php | 114 ---
test/PMA_localisedDateTimespan_test.php | 109 ---
test/PMA_pow_test.php | 82 ---
test/PMA_printableBitValue_test.php | 47 --
test/PMA_quoting_slashing_test.php | 111 ---
test/PMA_sanitize_test.php | 44 --
test/PMA_showHint_test.php | 14 +-
test/PMA_stringOperations_test.php | 134 ----
test/PMA_transformation_getOptions_test.php | 50 --
test/PMA_whichCrlf_test.php | 71 --
test/PmaSeleniumLoginTest.php | 20 -
test/PmaSeleniumPrivilegesTest.php | 47 --
test/PmaSeleniumTestCase.php | 100 ---
test/PmaSeleniumXssTest.php | 24 -
test/README | 11 +
test/bootstrap-dist.php | 14 +
test/classes/PMA_Config_test.php | 613 ++++++++++++++++
test/classes/PMA_Message_test.php | 432 ++++++++++++
test/classes/PMA_Theme_test.php | 206 ++++++
test/classes/_data/gen_version_info/info.inc.php | 7 +
test/classes/_data/incorrect_theme/info.inc.php | 7 +
test/libraries/PMA_SQL_parser_data_test.php | 55 ++
test/libraries/PMA_SQL_parser_test.php | 246 +++++++
test/libraries/PMA_STR_sub_test.php | 41 ++
test/libraries/PMA_blowfish_test.php | 51 ++
test/libraries/PMA_escapeJsString_test.php | 36 +
test/libraries/PMA_generateCommonUrl_test.php | 142 ++++
test/libraries/PMA_sanitize_test.php | 43 ++
.../PMA_transformation_getOptions_test.php | 46 ++
test/libraries/common/PMA_ajaxResponse_test.php | 72 ++
.../libraries/common/PMA_browseUploadFile_test.php | 48 ++
.../common/PMA_buildActionTitles_test.php | 42 ++
test/libraries/common/PMA_cache_test.php | 108 +++
test/libraries/common/PMA_checkParameters_test.php | 46 ++
.../PMA_contains_nonprintable_ascii_test.php | 37 +
.../common/PMA_convert_bit_default_value_test.php | 33 +
.../common/PMA_displayMaximumUploadSize_test.php | 41 ++
.../common/PMA_display_html_checkbox_test.php | 55 ++
.../common/PMA_display_html_radio_test.php | 188 +++++
.../common/PMA_escapeMySqlWildcards_test.php | 52 ++
.../PMA_extractValueFromFormattedSize_test.php | 37 +
.../common/PMA_foreignKeySupported_test.php | 37 +
.../common/PMA_formatNumberByteDown_test.php | 98 +++
test/libraries/common/PMA_formatSql_test.php | 744 ++++++++++++++++++++
.../common/PMA_generateHiddenMaxFileSize_test.php | 40 +
.../common/PMA_generate_html_dropdown_test.php | 69 ++
.../common/PMA_generate_slider_effect_test.php | 53 ++
test/libraries/common/PMA_getDbLink_test.php | 57 ++
test/libraries/common/PMA_getIcon_test.php | 74 ++
.../common/PMA_getTitleForTarget_test.php | 43 ++
.../common/PMA_localisedDateTimespan_test.php | 94 +++
test/libraries/common/PMA_pow_test.php | 80 +++
.../common/PMA_printableBitValue_test.php | 39 +
.../libraries/common/PMA_quoting_slashing_test.php | 108 +++
test/libraries/common/PMA_showDocu_test.php | 39 +
.../common/PMA_showMessage_test_disabled.php | 67 ++
test/libraries/common/PMA_showPHPDocu_test.php | 42 ++
.../libraries/common/PMA_stringOperations_test.php | 128 ++++
.../common/PMA_unsupportedDatatypes_test.php | 32 +
test/libraries/common/PMA_whichCrlf_test.php | 63 ++
test/libraries/core/PMA_array_test.php | 231 ++++++
test/libraries/core/PMA_checkPageValidity_test.php | 66 ++
test/libraries/core/PMA_fatalError_test.php | 43 ++
test/libraries/core/PMA_getLinks_test.php | 59 ++
test/libraries/core/PMA_getTableCount_test_dis.php | 37 +
test/libraries/core/PMA_get_real_size_test.php | 46 ++
.../core/PMA_headerLocation_test_disabled.php | 301 ++++++++
test/libraries/core/PMA_ifSetOr_test.php | 45 ++
test/libraries/core/PMA_isValid_test.php | 217 ++++++
test/libraries/core/PMA_securePath_test.php | 19 +
.../core/PMA_warnMissingExtension_test.php | 58 ++
test/libraries/php-gettext/Locales_test.php | 73 ++
test/libraries/php-gettext/Parsing_test.php | 65 ++
.../libraries/select_lang/PMA_langDetails_test.php | 96 +++
test/libraries/select_lang/PMA_langList_test.php | 51 ++
test/libraries/select_lang/PMA_langName_test.php | 35 +
test/selenium/PmaSeleniumLoginTest.php | 43 ++
test/selenium/PmaSeleniumPrivilegesTest.php | 48 ++
test/selenium/PmaSeleniumTestCase.php | 71 ++
test/selenium/PmaSeleniumXssTest.php | 25 +
themes/original/css/theme_left.css.php | 2 +-
themes/original/css/theme_right.css.php | 2 +-
104 files changed, 6431 insertions(+), 2745 deletions(-)
create mode 100644 build.xml
create mode 100644 phpunit.xml.dist
create mode 100644 test/.htaccess
delete mode 100644 test/FailTest.php
delete mode 100644 test/PMA_Message_test.php
delete mode 100644 test/PMA_SQL_parser_data_test.php
delete mode 100644 test/PMA_SQL_parser_test.php
delete mode 100644 test/PMA_STR_sub_test.php
delete mode 100644 test/PMA_blowfish_test.php
delete mode 100644 test/PMA_cache_test.php
delete mode 100644 test/PMA_escapeJsString_test.php
delete mode 100644 test/PMA_escapeMySqlWildcards_test.php
delete mode 100644 test/PMA_foreignKeySupported_test.php
delete mode 100644 test/PMA_formatNumberByteDown_test.php
delete mode 100644 test/PMA_generateCommonUrl_test.php
delete mode 100644 test/PMA_get_real_size_test.php
delete mode 100644 test/PMA_headerLocation_test.php
delete mode 100644 test/PMA_ifSetOr_test.php
delete mode 100644 test/PMA_isValid_test.php
delete mode 100644 test/PMA_localisedDateTimespan_test.php
delete mode 100644 test/PMA_pow_test.php
delete mode 100644 test/PMA_printableBitValue_test.php
delete mode 100644 test/PMA_quoting_slashing_test.php
delete mode 100644 test/PMA_sanitize_test.php
delete mode 100644 test/PMA_stringOperations_test.php
delete mode 100644 test/PMA_transformation_getOptions_test.php
delete mode 100644 test/PMA_whichCrlf_test.php
delete mode 100644 test/PmaSeleniumLoginTest.php
delete mode 100644 test/PmaSeleniumPrivilegesTest.php
delete mode 100644 test/PmaSeleniumTestCase.php
delete mode 100644 test/PmaSeleniumXssTest.php
create mode 100644 test/README
create mode 100644 test/bootstrap-dist.php
create mode 100644 test/classes/PMA_Config_test.php
create mode 100644 test/classes/PMA_Message_test.php
create mode 100644 test/classes/PMA_Theme_test.php
create mode 100644 test/classes/_data/gen_version_info/info.inc.php
create mode 100644 test/classes/_data/incorrect_theme/info.inc.php
create mode 100644 test/libraries/PMA_SQL_parser_data_test.php
create mode 100644 test/libraries/PMA_SQL_parser_test.php
create mode 100644 test/libraries/PMA_STR_sub_test.php
create mode 100644 test/libraries/PMA_blowfish_test.php
create mode 100644 test/libraries/PMA_escapeJsString_test.php
create mode 100644 test/libraries/PMA_generateCommonUrl_test.php
create mode 100644 test/libraries/PMA_sanitize_test.php
create mode 100644 test/libraries/PMA_transformation_getOptions_test.php
create mode 100644 test/libraries/common/PMA_ajaxResponse_test.php
create mode 100644 test/libraries/common/PMA_browseUploadFile_test.php
create mode 100644 test/libraries/common/PMA_buildActionTitles_test.php
create mode 100644 test/libraries/common/PMA_cache_test.php
create mode 100644 test/libraries/common/PMA_checkParameters_test.php
create mode 100644 test/libraries/common/PMA_contains_nonprintable_ascii_test.php
create mode 100644 test/libraries/common/PMA_convert_bit_default_value_test.php
create mode 100644 test/libraries/common/PMA_displayMaximumUploadSize_test.php
create mode 100644 test/libraries/common/PMA_display_html_checkbox_test.php
create mode 100644 test/libraries/common/PMA_display_html_radio_test.php
create mode 100644 test/libraries/common/PMA_escapeMySqlWildcards_test.php
create mode 100644 test/libraries/common/PMA_extractValueFromFormattedSize_test.php
create mode 100644 test/libraries/common/PMA_foreignKeySupported_test.php
create mode 100644 test/libraries/common/PMA_formatNumberByteDown_test.php
create mode 100644 test/libraries/common/PMA_formatSql_test.php
create mode 100644 test/libraries/common/PMA_generateHiddenMaxFileSize_test.php
create mode 100644 test/libraries/common/PMA_generate_html_dropdown_test.php
create mode 100644 test/libraries/common/PMA_generate_slider_effect_test.php
create mode 100644 test/libraries/common/PMA_getDbLink_test.php
create mode 100644 test/libraries/common/PMA_getIcon_test.php
create mode 100644 test/libraries/common/PMA_getTitleForTarget_test.php
create mode 100644 test/libraries/common/PMA_localisedDateTimespan_test.php
create mode 100644 test/libraries/common/PMA_pow_test.php
create mode 100644 test/libraries/common/PMA_printableBitValue_test.php
create mode 100644 test/libraries/common/PMA_quoting_slashing_test.php
create mode 100644 test/libraries/common/PMA_showDocu_test.php
create mode 100644 test/libraries/common/PMA_showMessage_test_disabled.php
create mode 100644 test/libraries/common/PMA_showPHPDocu_test.php
create mode 100644 test/libraries/common/PMA_stringOperations_test.php
create mode 100644 test/libraries/common/PMA_unsupportedDatatypes_test.php
create mode 100644 test/libraries/common/PMA_whichCrlf_test.php
create mode 100644 test/libraries/core/PMA_array_test.php
create mode 100644 test/libraries/core/PMA_checkPageValidity_test.php
create mode 100644 test/libraries/core/PMA_fatalError_test.php
create mode 100644 test/libraries/core/PMA_getLinks_test.php
create mode 100644 test/libraries/core/PMA_getTableCount_test_dis.php
create mode 100644 test/libraries/core/PMA_get_real_size_test.php
create mode 100644 test/libraries/core/PMA_headerLocation_test_disabled.php
create mode 100644 test/libraries/core/PMA_ifSetOr_test.php
create mode 100644 test/libraries/core/PMA_isValid_test.php
create mode 100644 test/libraries/core/PMA_securePath_test.php
create mode 100644 test/libraries/core/PMA_warnMissingExtension_test.php
create mode 100644 test/libraries/php-gettext/Locales_test.php
create mode 100644 test/libraries/php-gettext/Parsing_test.php
create mode 100644 test/libraries/select_lang/PMA_langDetails_test.php
create mode 100644 test/libraries/select_lang/PMA_langList_test.php
create mode 100644 test/libraries/select_lang/PMA_langName_test.php
create mode 100644 test/selenium/PmaSeleniumLoginTest.php
create mode 100644 test/selenium/PmaSeleniumPrivilegesTest.php
create mode 100644 test/selenium/PmaSeleniumTestCase.php
create mode 100644 test/selenium/PmaSeleniumXssTest.php
diff --git a/.gitignore b/.gitignore
index dda2e0e..6cc231a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,7 @@ phpmyadmin.wpj
.buildpath
.cache
.idea
+.netbeans
*.sw[op]
# Locales
/locale/
@@ -31,3 +32,8 @@ phpmyadmin.wpj
/apidoc/
# Demo server
revision-info.php
+# PHPUnit
+phpunit.xml
+/test/bootstrap.php
+# Jenkins
+/build/
\ No newline at end of file
diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..a6f09da
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project name="phpMyAdmin" default="build" basedir=".">
+ <property name="source" value="."/>
+ <property name="source_comma_sep" value="."/>
+
+ <target name="clean" description="Clean up and create artifact directories">
+ <delete dir="${basedir}/build/api"/>
+ <delete dir="${basedir}/build/code-browser"/>
+ <delete dir="${basedir}/build/coverage"/>
+ <delete dir="${basedir}/build/logs"/>
+ <delete dir="${basedir}/build/pdepend"/>
+
+ <mkdir dir="${basedir}/build/api"/>
+ <mkdir dir="${basedir}/build/code-browser"/>
+ <mkdir dir="${basedir}/build/coverage"/>
+ <mkdir dir="${basedir}/build/logs"/>
+ <mkdir dir="${basedir}/build/pdepend"/>
+ </target>
+
+ <target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
+ <exec executable="phpunit">
+ <arg line="--configuration phpunit.xml.dist"/>
+ </exec>
+ </target>
+
+ <target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend">
+ <exec executable="pdepend">
+ <arg line="--jdepend-xml=${basedir}/build/logs/jdepend.xml
+ --jdepend-chart=${basedir}/build/pdepend/dependencies.svg
+ --overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg
+ ${source_comma_sep}" />
+ </exec>
+ </target>
+
+ <target name="phpmd" description="Generate pmd.xml using PHPMD">
+ <exec executable="phpmd">
+ <arg line="${source_comma_sep}
+ xml
+ codesize,design,naming,unusedcode
+ --reportfile ${basedir}/build/logs/pmd.xml" />
+ </exec>
+ </target>
+
+ <target name="phpcpd" description="Generate pmd-cpd.xml using PHPCPD">
+ <exec executable="phpcpd">
+ <arg line="--log-pmd ${basedir}/build/logs/pmd-cpd.xml
+ --exclude test
+ --exclude libraries/PHPExcel
+ --exclude libraries/tcpdf
+ ${source}" />
+ </exec>
+ </target>
+
+ <target name="phploc" description="Generate phploc.csv">
+ <exec executable="phploc">
+ <arg line="--log-csv ${basedir}/build/logs/phploc.csv ${source}" />
+ </exec>
+ </target>
+
+ <target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer excluding test, PHPExcel, tcpdf directories">
+ <exec executable="phpcs">
+ <arg line="-v
+ --ignore=*/PHPExcel/*,*/php-gettext/*,*/tcpdf/*
+ --report=checkstyle
+ --report-file=${basedir}/build/logs/checkstyle.xml
+ --standard=PEAR
+ ${source}" />
+ </exec>
+ </target>
+
+ <target name="phpdoc" description="Generate API documentation using PHPDocumentor">
+ <exec executable="phpdoc">
+ <arg line="-d ${source} -t ${basedir}/build/api" />
+ </exec>
+ </target>
+
+ <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
+ <exec executable="phpcb">
+ <arg line="--log ${basedir}/build/logs
+ --source ${source}
+ --output ${basedir}/build/code-browser" />
+ </exec>
+ </target>
+
+ <target name="build" depends="clean,phpunit,pdepend,phpmd,phpcpd,phpcs,phpdoc,phploc,phpcb"/>
+</project>
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index e64c751..e4c7cbd 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -2846,7 +2846,9 @@ function PMA_ajaxResponse($message, $success = true, $extra_data = array())
header("Content-Type: application/json");
echo json_encode($response);
- exit;
+
+ if(!defined('TESTSUITE'))
+ exit;
}
/**
diff --git a/libraries/core.lib.php b/libraries/core.lib.php
index 371aec2..fe533e3 100644
--- a/libraries/core.lib.php
+++ b/libraries/core.lib.php
@@ -224,8 +224,10 @@ function PMA_fatalError($error_message, $message_args = null)
}
require('./libraries/error.inc.php');
-
- exit;
+
+ if (!defined('TESTSUITE')) {
+ exit;
+ }
}
/**
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..41782b7
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit bootstrap="test/bootstrap-dist.php"
+ backupGlobals="false"
+ backupStaticAttributes="false"
+ strict="true"
+ verbose="true">
+
+ <selenium>
+ <browser name="Firefox on localhost"
+ browser="*firefox"
+ host="127.0.0.1"
+ port="4444"
+ timeout="30000"/>
+ <browser name="Google Chrome on localhost"
+ browser="googlechrome"
+ host="127.0.0.1"
+ port="4444"
+ timeout="30000"/>
+ </selenium>
+
+ <php>
+ <const name="TESTSUITE_SERVER" value="localhost"/>
+ <const name="TESTSUITE_USER" value="root"/>
+ <const name="TESTSUITE_PASSWORD" value=""/>
+ <const name="TESTSUITE_DATABASE" value="test"/>
+ <const name="TESTSUITE_PHPMYADMIN_HOST" value="http://localhost" />
+ <const name="TESTSUITE_PHPMYADMIN_URL" value="/phpmyadmin" />
+ </php>
+
+ <testsuites>
+ <testsuite name="Classes">
+ <directory suffix="_test.php">test/classes</directory>
+ </testsuite>
+ <testsuite name="Unit">
+ <file>test/Environment_test.php</file>
+ <directory suffix="_test.php">test/libraries/core</directory>
+ <directory suffix="_test.php">test/libraries/common</directory>
+ <directory suffix="_test.php">test/libraries</directory>
+ </testsuite>
+ <!--<testsuite name="Selenium">-->
+ <!--<directory suffix="Test.php">test/selenium</directory>-->
+ <!--</testsuite>-->
+ </testsuites>
+
+ <logging>
+ <log type="coverage-html" target="build/coverage" title="phpMyAdmin"
+ charset="UTF-8" yui="true" highlight="true"
+ lowUpperBound="35" highLowerBound="70"/>
+ <log type="coverage-clover" target="build/logs/clover.xml"/>
+ <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
+ </logging>
+
+</phpunit>
diff --git a/test/.htaccess b/test/.htaccess
new file mode 100644
index 0000000..d4984c2
--- /dev/null
+++ b/test/.htaccess
@@ -0,0 +1,6 @@
+# This folder does NOT need to be accessible over HTTP
+# In most cases the tests included here will be run from a command line interface.
+
+# (the following directive denies access by default)
+# For more information see: http://httpd.apache.org/docs/current/mod/mod_authz_host.html#allow
+Order allow,deny
diff --git a/test/Environment_test.php b/test/Environment_test.php
index f61956f..c72a165 100644
--- a/test/Environment_test.php
+++ b/test/Environment_test.php
@@ -9,7 +9,7 @@
/**
*
*/
-require_once 'PHPUnit/Framework.php';
+require_once 'config.sample.inc.php';
/**
* @package phpMyAdmin-test
@@ -24,12 +24,28 @@ class Environment_test extends PHPUnit_Framework_TestCase
public function testMySQL()
{
- $this->markTestIncomplete();
- }
+ try{
+ $pdo = new PDO("mysql:host=".TESTSUITE_SERVER.";dbname=".TESTSUITE_DATABASE, TESTSUITE_USER, TESTSUITE_PASSWORD);
+ $this->assertNull($pdo->errorCode(),"Error when trying to connect to database");
- public function testSession()
- {
- $this->markTestIncomplete();
+ //$pdo->beginTransaction();
+ $test = $pdo->exec("SHOW TABLES;");
+ //$pdo->commit();
+ $this->assertEquals(0, $pdo->errorCode(), 'Error trying to show tables for database');
+ }
+ catch (Exception $e){
+ $this->fail("Error: ".$e->getMessage());
+ }
+
+ // Check id MySQL server is 5 version
+ preg_match("/^(\d+)?\.(\d+)?\.(\*|\d+)/", $pdo->getAttribute(constant("PDO::ATTR_SERVER_VERSION")), $version_parts);
+ $this->assertEquals(5, $version_parts[1]);
}
+
+ //TODO: Think about this test
+// public function testSession()
+// {
+// $this->markTestIncomplete();
+// }
}
?>
diff --git a/test/FailTest.php b/test/FailTest.php
deleted file mode 100644
index f430bb4..0000000
--- a/test/FailTest.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * tests for PMA_get_real_size()
- *
- * @package phpMyAdmin-test
- */
-
-/**
- *
- */
-require_once 'PHPUnit/Framework.php';
-
-/**
- * @package phpMyAdmin-test
- */
-class FailTest extends PHPUnit_Framework_TestCase
-{
- public function testFail()
- {
- $this->assertEquals(0, 1);
- }
-}
-?>
diff --git a/test/PMA_Message_test.php b/test/PMA_Message_test.php
deleted file mode 100644
index ed7694e..0000000
--- a/test/PMA_Message_test.php
+++ /dev/null
@@ -1,388 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Test for PMA_Message class
- *
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-require_once 'PHPUnit/Extensions/OutputTestCase.php';
-
-/**
- * Include to test.
- */
-require_once './libraries/Message.class.php';
-
-/**
- * Test class PMA_Message.
- *
- * @package phpMyAdmin-test
- */
-class PMA_Message_test extends PHPUnit_Extensions_OutputTestCase
-{
- /**
- * @var PMA_Message
- * @access protected
- */
- protected $object;
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @access protected
- */
- protected function setUp()
- {
- $this->object = new PMA_Message;
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- *
- * @access protected
- */
- protected function tearDown()
- {
- }
-
- /**
- * to String casting test
- */
- public function test__toString()
- {
- $this->object->setMessage('test<&>', true);
- $this->assertEquals('test<&>', (string)$this->object);
- }
-
- /**
- * test success method
- */
- public function testSuccess()
- {
- $this->object = new PMA_Message('test<&>', PMA_Message::SUCCESS);
- $this->assertEquals($this->object, PMA_Message::success('test<&>'));
- $this->assertEquals('Your SQL query has been executed successfully', PMA_Message::success()->getString());
- }
-
- /**
- * test error method
- */
- public function testError()
- {
- $this->object = new PMA_Message('test<&>', PMA_Message::ERROR);
- $this->assertEquals($this->object, PMA_Message::error('test<&>'));
- $this->assertEquals('Error', PMA_Message::error()->getString());
- }
-
- /**
- * test notice method
- */
- public function testNotice()
- {
- $this->object = new PMA_Message('test<&>', PMA_Message::NOTICE);
- $this->assertEquals($this->object, PMA_Message::notice('test<&>'));
- }
-
- /**
- * test rawError method
- */
- public function testRawError()
- {
- $this->object = new PMA_Message('', PMA_Message::ERROR);
- $this->object->setMessage('test<&>');
-
- $this->assertEquals($this->object, PMA_Message::rawError('test<&>'));
- }
-
- /**
- * test rawWarning method
- */
- public function testRawWarning()
- {
- $this->object = new PMA_Message('', PMA_Message::WARNING);
- $this->object->setMessage('test<&>');
-
- $this->assertEquals($this->object, PMA_Message::rawWarning('test<&>'));
- }
-
- /**
- * test rawNotice method
- */
- public function testRawNotice()
- {
- $this->object = new PMA_Message('', PMA_Message::NOTICE);
- $this->object->setMessage('test<&>');
-
- $this->assertEquals($this->object, PMA_Message::rawNotice('test<&>'));
- }
-
- /**
- * test rawSuccess method
- */
- public function testRawSuccess()
- {
- $this->object = new PMA_Message('', PMA_Message::SUCCESS);
- $this->object->setMessage('test<&>');
-
- $this->assertEquals($this->object, PMA_Message::rawSuccess('test<&>'));
- }
-
- /**
- * testing isSuccess method
- */
- public function testIsSuccess()
- {
- $this->assertFalse($this->object->isSuccess());
- $this->assertTrue($this->object->isSuccess(true));
- }
-
- /**
- * testing isNotice method
- */
- public function testIsNotice()
- {
- $this->assertTrue($this->object->isNotice());
- $this->object->isError(true);
- $this->assertFalse($this->object->isNotice());
- $this->assertTrue($this->object->isNotice(true));
- }
-
- /**
- * testing isError method
- */
- public function testIsError()
- {
- $this->assertFalse($this->object->isError());
- $this->assertTrue($this->object->isError(true));
- }
-
- /**
- * testign setter of message
- */
- public function testSetMessage()
- {
- $this->object->setMessage('test&<>', false);
- $this->assertEquals('test&<>', $this->object->getMessage());
- $this->object->setMessage('test&<>', true);
- $this->assertEquals('test&<>', $this->object->getMessage());
- }
-
- /**
- * testing setter of string
- */
- public function testSetString()
- {
- $this->object->setString('test&<>', false);
- $this->assertEquals('test&<>', $this->object->getString());
- $this->object->setString('test&<>', true);
- $this->assertEquals('test&<>', $this->object->getString());
- }
-
- /**
- * testing add param method
- */
- public function testAddParam()
- {
- $this->object->addParam(PMA_Message::notice('test'));
- $this->assertEquals(array(PMA_Message::notice('test')), $this->object->getParams());
- $this->object->addParam('test', true);
- $this->assertEquals(array(PMA_Message::notice('test'), 'test'), $this->object->getParams());
- $this->object->addParam('test', false);
- $this->assertEquals(array(PMA_Message::notice('test'), 'test', PMA_Message::notice('test')), $this->object->getParams());
- }
-
- /**
- * testing add string method
- */
- public function testAddString()
- {
- $this->object->addString('test', '*');
- $this->assertEquals(array('*', PMA_Message::notice('test')), $this->object->getAddedMessages());
- $this->object->addString('test', '');
- $this->assertEquals(array('*', PMA_Message::notice('test'), '', PMA_Message::notice('test')), $this->object->getAddedMessages());
- }
-
- /**
- * testing add messages method
- */
- public function testAddMessages()
- {
- $this->object->addMessages(array('test', PMA_Message::rawWarning('test')), '&');
- $this->assertEquals(array('&', PMA_Message::rawNotice('test'), '&', PMA_Message::rawWarning('test')), $this->object->getAddedMessages());
- }
-
- /**
- * testing add message method
- */
- public function testAddMessage()
- {
- $this->object->addMessage('test', '');
- $this->assertEquals(array(PMA_Message::rawNotice('test')), $this->object->getAddedMessages());
- $this->object->addMessage('test');
- $this->assertEquals(array(PMA_Message::rawNotice('test'), ' ', PMA_Message::rawNotice('test')), $this->object->getAddedMessages());
- $this->object->addMessage(PMA_Message::rawWarning('test'), '&');
- $this->assertEquals(array(PMA_Message::rawNotice('test'), ' ', PMA_Message::rawNotice('test'), '&', PMA_Message::rawWarning('test')), $this->object->getAddedMessages());
- }
-
- /**
- * testing setter of params
- */
- public function testSetParams()
- {
- $this->object->setParams('test&<>');
- $this->assertEquals('test&<>', $this->object->getParams());
- $this->object->setParams('test&<>', true);
- $this->assertEquals('test&<>', $this->object->getParams());
- }
-
- /**
- * testing sanitize method
- */
- public function testSanitize()
- {
- $this->object->setString('test&string<>', false);
- $this->assertEquals('test&string<>', PMA_Message::sanitize($this->object));
- $this->assertEquals(array('test&string<>', 'test&string<>'), PMA_Message::sanitize(array($this->object, $this->object)));
- }
-
- public function decodeBBDataProvider()
- {
- return array(
- array('[i]test[/i][i]aa[i/][em]test[/em]', '<em>test</em><em>aa[i/]<em>test</em>'),
- array('[b]test[/b][strong]test[/strong]', '<strong>test</strong><strong>test</strong>'),
- array('[tt]test[/tt][code]test[/code]', '<code>test</code><code>test</code>'),
- array('[kbd]test[/kbd][br][sup]test[/sup]', '<kbd>test</kbd><br /><sup>test</sup>')
- );
- }
-
- /**
- * testing decodeBB method
- * @dataProvider decodeBBDataProvider
- */
-
- public function testDecodeBB($actual, $expected)
- {
- $this->assertEquals($expected, PMA_Message::decodeBB($actual));
- }
-
- /**
- * testing format method
- */
- public function testFormat()
- {
- $this->assertEquals('test string', PMA_Message::format('test string'));
- $this->assertEquals('test string', PMA_Message::format('test string', 'a'));
- $this->assertEquals('test string', PMA_Message::format('test string', array()));
- $this->assertEquals('test string', PMA_Message::format('%s string', array('test')));
-
- }
-
- /**
- * testing getHash method
- */
- public function testGetHash()
- {
- $this->object->setString('<&>test', false);
- $this->object->setMessage('<&>test', false);
- $this->assertEquals(md5(PMA_Message::NOTICE . '<&>test<&>test'), $this->object->getHash());
- }
-
- /**
- * getMessage test - with empty message and with non-empty string - not key in globals
- * additional params are defined
- */
- public function testGetMessageWithoutMessageWithStringWithParams()
- {
- $this->object->setMessage('');
- $this->object->setString('test string %s %s');
- $this->object->addParam('test param 1');
- $this->object->addParam('test param 2');
- $this->assertEquals('test string test param 1 test param 2', $this->object->getMessage());
- }
-
- /**
- * getMessage test - with empty message and with empty string
- */
- public function testGetMessageWithoutMessageWithEmptyString()
- {
- $this->object->setMessage('');
- $this->object->setString('');
- $this->assertEquals('', $this->object->getMessage());
- }
-
- /**
- * getMessage test - with empty message and with string, which is key to GLOBALS
- * additional messages are defined
- */
- public function testGetMessageWithoutMessageWithGlobalStringWithAddMessages()
- {
- $GLOBALS['key'] = 'test message';
- $this->object->setMessage('');
- $this->object->setString('key');
- $this->object->addMessage('test message 2', ' - ');
- $this->object->addMessage('test message 3', '&');
- $this->assertEquals('test message - test message 2&test message 3', $this->object->getMessage());
- unset($GLOBALS['key']);
- }
-
- /**
- * getMessage test - message is defined
- * message with BBCode defined
- */
- public function testGetMessageWithMessageWithBBCode()
- {
- $this->object->setMessage('[kbd]test[/kbd] [a@./Documentation.html#cfg_Example@_blank]test[/a]');
- $this->assertEquals('<kbd>test</kbd> <a href="./Documentation.html#cfg_Example" target="_blank">test</a>', $this->object->getMessage());
- }
-
- /**
- * getLevel test
- */
- public function testGetLevel()
- {
- $this->assertEquals('notice', $this->object->getLevel());
- $this->object->setNumber(PMA_Message::SUCCESS);
- $this->assertEquals('success', $this->object->getLevel());
- $this->object->setNumber(PMA_Message::ERROR);
- $this->assertEquals('error', $this->object->getLevel());
- }
-
- /**
- * testing display method (output string and _is_displayed varible)
- */
- public function testDisplay()
- {
- $this->assertFalse($this->object->isDisplayed());
- $this->object->setMessage('Test Message');
-
- $this->expectOutputString('<div class="notice">Test Message</div>');
- $this->object->display();
-
- $this->assertTrue($this->object->isDisplayed());
- }
-
- /**
- * getDisplay test
- */
- public function testGetDisplay()
- {
- $this->object->setMessage('Test Message');
- $this->assertEquals('<div class="notice">Test Message</div>', $this->object->getDisplay());
- }
-
- /**
- * isDisplayed test
- */
- public function testIsDisplayed()
- {
- $this->assertFalse($this->object->isDisplayed(false));
- $this->assertTrue($this->object->isDisplayed(true));
- $this->assertTrue($this->object->isDisplayed(false));
- }
-}
-?>
diff --git a/test/PMA_SQL_parser_data_test.php b/test/PMA_SQL_parser_data_test.php
deleted file mode 100644
index 7be8b4f..0000000
--- a/test/PMA_SQL_parser_data_test.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * tests for correctness of SQL parser data
- *
- * @package phpMyAdmin-test
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-
-define('PHPMYADMIN', 1);
-
-/**
- * Include to test.
- */
-require_once './libraries/sqlparser.data.php';
-
-/**
- * Test for sorting of the arrays
- *
- * @package phpMyAdmin-test
- */
-class PMA_SQL_parser_data_test extends PHPUnit_Framework_TestCase
-{
- private function assertSorted($array)
- {
- $copy = $array;
- sort($copy);
- $difference = array_diff_assoc($array, $copy);
- $this->assertEquals($difference, array());
- }
-
- private function assertParserData($name)
- {
- $this->assertSorted($GLOBALS[$name]);
- }
-
- public function testPMA_SQPdata_function_name()
- {
- $this->assertParserData('PMA_SQPdata_function_name');
- }
-
- public function testPMA_SQPdata_column_attrib()
- {
- $this->assertParserData('PMA_SQPdata_column_attrib');
- }
-
- public function testPMA_SQPdata_reserved_word()
- {
- $this->assertParserData('PMA_SQPdata_reserved_word');
- }
-
- public function testPMA_SQPdata_forbidden_word()
- {
- $this->assertParserData('PMA_SQPdata_forbidden_word');
- }
-
- public function testPMA_SQPdata_column_type()
- {
- $this->assertParserData('PMA_SQPdata_column_type');
- }
-
-}
-?>
diff --git a/test/PMA_SQL_parser_test.php b/test/PMA_SQL_parser_test.php
deleted file mode 100644
index d384bd2..0000000
--- a/test/PMA_SQL_parser_test.php
+++ /dev/null
@@ -1,262 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * tests for correctness of SQL parser
- *
- * @package phpMyAdmin-test
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-
-define('PHPMYADMIN', 1);
-define('TESTSUITE', 1);
-
-function __($s) {
- return $s;
-}
-
-/**
- * Include to test.
- */
-require_once './libraries/sqlparser.lib.php';
-
-/**
- * Test for SQL parser
- *
- * @package phpMyAdmin-test
- */
-class PMA_SQL_parser_test extends PHPUnit_Framework_TestCase
-{
- private function assertParser($sql, $expected, $error = '')
- {
- $parsed_sql = PMA_SQP_parse($sql);
- $this->assertEquals(PMA_SQP_getErrorString(), $error);
- $this->assertEquals($parsed_sql, $expected);
- }
-
- public function testParse_1()
- {
- $this->assertParser('SELECT 1;', array (
- 'raw' => 'SELECT 1;',
- 0 =>
- array (
- 'type' => 'alpha_reservedWord',
- 'data' => 'SELECT',
- 'pos' => 6,
- 'forbidden' => true,
- ),
- 1 =>
- array (
- 'type' => 'digit_integer',
- 'data' => '1',
- 'pos' => 8,
- ),
- 2 =>
- array (
- 'type' => 'punct_queryend',
- 'data' => ';',
- 'pos' => 0,
- ),
- 'len' => 3,
- ));
- }
-
- public function testParse_2()
- {
- $this->assertParser('SELECT * from aaa;', array (
- 'raw' => 'SELECT * from aaa;',
- 0 =>
- array (
- 'type' => 'alpha_reservedWord',
- 'data' => 'SELECT',
- 'pos' => 6,
- 'forbidden' => true,
- ),
- 1 =>
- array (
- 'type' => 'punct',
- 'data' => '*',
- 'pos' => 0,
- ),
- 2 =>
- array (
- 'type' => 'alpha_reservedWord',
- 'data' => 'from',
- 'pos' => 13,
- 'forbidden' => true,
- ),
- 3 =>
- array (
- 'type' => 'alpha_identifier',
- 'data' => 'aaa',
- 'pos' => 17,
- 'forbidden' => false,
- ),
- 4 =>
- array (
- 'type' => 'punct_queryend',
- 'data' => ';',
- 'pos' => 0,
- ),
- 'len' => 5,
- ));
- }
-
- public function testParse_3()
- {
- $this->assertParser('SELECT * from `aaa`;', array (
- 'raw' => 'SELECT * from `aaa`;',
- 0 =>
- array (
- 'type' => 'alpha_reservedWord',
- 'data' => 'SELECT',
- 'pos' => 6,
- 'forbidden' => true,
- ),
- 1 =>
- array (
- 'type' => 'punct',
- 'data' => '*',
- 'pos' => 0,
- ),
- 2 =>
- array (
- 'type' => 'alpha_reservedWord',
- 'data' => 'from',
- 'pos' => 13,
- 'forbidden' => true,
- ),
- 3 =>
- array (
- 'type' => 'quote_backtick',
- 'data' => '`aaa`',
- 'pos' => 0,
- ),
- 4 =>
- array (
- 'type' => 'punct_queryend',
- 'data' => ';',
- 'pos' => 0,
- ),
- 'len' => 5,
- ));
- }
-
- public function testParse_4()
- {
- $this->assertParser('SELECT * from `aaa;', array (
- 'raw' => 'SELECT * from `aaa`;',
- 0 =>
- array (
- 'type' => 'alpha_reservedWord',
- 'data' => 'SELECT',
- 'pos' => 6,
- 'forbidden' => true,
- ),
- 1 =>
- array (
- 'type' => 'punct',
- 'data' => '*',
- 'pos' => 0,
- ),
- 2 =>
- array (
- 'type' => 'alpha_reservedWord',
- 'data' => 'from',
- 'pos' => 13,
- 'forbidden' => true,
- ),
- 3 =>
- array (
- 'type' => 'quote_backtick',
- 'data' => '`aaa`',
- 'pos' => 0,
- ),
- 4 =>
- array (
- 'type' => 'punct_queryend',
- 'data' => ';',
- 'pos' => 0,
- ),
- 'len' => 5,
- ));
- }
-
- public function testParse_5()
- {
- $this->assertParser('SELECT * FROM `a_table` tbla INNER JOIN b_table` tblb ON tblb.id = tbla.id WHERE tblb.field1 != tbla.field1`;', array (
- 'raw' => 'SELECT * FROM `a_table` tbla INNER JOIN b_table` tblb ON tblb.id = tbla.id WHERE tblb.field1 != tbla.field1`;',
- 0 =>
- array (
- 'type' => 'alpha_reservedWord',
- 'data' => 'SELECT',
- 'pos' => 6,
- 'forbidden' => true,
- ),
- 1 =>
- array (
- 'type' => 'punct',
- 'data' => '*',
- 'pos' => 0,
- ),
- 2 =>
- array (
- 'type' => 'alpha_reservedWord',
- 'data' => 'FROM',
- 'pos' => 13,
- 'forbidden' => true,
- ),
- 3 =>
- array (
- 'type' => 'quote_backtick',
- 'data' => '`a_table`',
- 'pos' => 0,
- ),
- 4 =>
- array (
- 'type' => 'alpha_identifier',
- 'data' => 'tbla',
- 'pos' => 28,
- 'forbidden' => false,
- ),
- 5 =>
- array (
- 'type' => 'alpha_reservedWord',
- 'data' => 'INNER',
- 'pos' => 34,
- 'forbidden' => true,
- ),
- 6 =>
- array (
- 'type' => 'alpha_reservedWord',
- 'data' => 'JOIN',
- 'pos' => 39,
- 'forbidden' => true,
- ),
- 7 =>
- array (
- 'type' => 'alpha_identifier',
- 'data' => 'b_table',
- 'pos' => 47,
- 'forbidden' => false,
- ),
- 8 =>
- array (
- 'type' => 'quote_backtick',
- 'data' => '` tblb ON tblb.id = tbla.id WHERE tblb.field1 != tbla.field1`',
- 'pos' => 0,
- ),
- 9 =>
- array (
- 'type' => 'punct_queryend',
- 'data' => ';',
- 'pos' => 0,
- ),
- 'len' => 10,
- ));
- }
-}
-?>
diff --git a/test/PMA_STR_sub_test.php b/test/PMA_STR_sub_test.php
deleted file mode 100644
index 640c777..0000000
--- a/test/PMA_STR_sub_test.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * tests for PMA_pow()
- *
- * @package phpMyAdmin-test
- */
-
-/**
- *
- */
-require_once 'PHPUnit/Framework.php';
-
-$match = array();
-preg_match('@^([0-9]{1,2})(?:.([0-9]{1,2})(?:.([0-9]{1,2}))?)?@',
- phpversion(), $match);
-if (isset($match) && ! empty($match[1])) {
- if (! isset($match[2])) {
- $match[2] = 0;
- }
- if (! isset($match[3])) {
- $match[3] = 0;
- }
- /**
- * @ignore
- */
- define('PMA_PHP_INT_VERSION',
- (int) sprintf('%d%02d%02d', $match[1], $match[2], $match[3]));
-} else {
- /**
- * @ignore
- */
- define('PMA_PHP_INT_VERSION', 0);
-}
-
-require_once './libraries/string.lib.php';
-
-/**
- * @package phpMyAdmin-test
- */
-class PMA_STR_sub_test extends PHPUnit_Framework_TestCase
-{
- public function testMultiByte()
- {
- $this->assertEquals('čšě',
- PMA_substr('čšěčščěš', 0, 3));
- }
-}
-?>
diff --git a/test/PMA_blowfish_test.php b/test/PMA_blowfish_test.php
deleted file mode 100644
index 234339a..0000000
--- a/test/PMA_blowfish_test.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Test for blowfish encryption.
- *
- * @package phpMyAdmin-test
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-
-/**
- * Include to test.
- */
-require_once './libraries/blowfish.php';
-
-/**
- * Test java script escaping.
- *
- * @package phpMyAdmin-test
- */
-class PMA_blowfish_test extends PHPUnit_Framework_TestCase
-{
- public function testEncryptDecryptNumbers()
- {
- $secret = '$%ÄüfuDFRR';
- $string = '12345678';
- $this->assertEquals($string,
- PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret));
- }
-
- public function testEncryptDecryptChars()
- {
- $secret = '$%ÄüfuDFRR';
- $string = 'abcDEF012!"§$%&/()=?`´"\',.;:-_#+*~öäüÖÄÜ^°²³';
- $this->assertEquals($string,
- PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret));
- }
-
- public function testEncrypt()
- {
- $secret = '$%ÄüfuDFRR';
- $decrypted = '12345678';
- $encrypted = 'kO/kc4j/nyk=';
- $this->assertEquals($encrypted, PMA_blowfish_encrypt($decrypted, $secret));
- }
-
- public function testDecrypt()
- {
- $secret = '$%ÄüfuDFRR';
- $encrypted = 'kO/kc4j/nyk=';
- $decrypted = '12345678';
- $this->assertEquals($decrypted, PMA_blowfish_decrypt($encrypted, $secret));
- }
-
-}
-?>
diff --git a/test/PMA_cache_test.php b/test/PMA_cache_test.php
deleted file mode 100644
index 34aa5f9..0000000
--- a/test/PMA_cache_test.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Test for caching data in session
- *
- * @package phpMyAdmin-test
- * @version $Id: PMA_cache_test.php
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-
-/**
- * Include to test.
- */
-require_once './libraries/common.lib.php';
-
-/**
- * Test cache.
- *
- */
-class PMA_cache_test extends PHPUnit_Framework_TestCase
-{
-
- /**
- * @var array temporary variable for globals array
- */
- protected $tmpGlobals;
-
- /**
- * @var array temporary variable for session array
- */
- protected $tmpSession;
-
- /**
- * storing globals and session
- */
- public function setUp()
- {
- $this->tmpGlobals = $GLOBALS;
- $this->tmpSession = $_SESSION;
- }
-
- /**
- * Test if cached data is available after set
- */
- public function testCacheExists()
- {
- $GLOBALS['server'] = 'server';
- PMA_cacheSet('test_data', 5, true);
- PMA_cacheSet('test_data_2', 5, true);
-
- $this->assertTrue(PMA_cacheExists('test_data', true));
- $this->assertTrue(PMA_cacheExists('test_data_2', 'server'));
- $this->assertFalse(PMA_cacheExists('fake_data_2', true));
- }
-
- /**
- * Test if cacheGet does not return data for non existing caache entries
- */
- public function testCacheGet()
- {
- $GLOBALS['server'] = 'server';
- PMA_cacheSet('test_data', 5, true);
- PMA_cacheSet('test_data_2', 5, true);
-
- $this->assertNotNull(PMA_cacheGet('test_data', true));
- $this->assertNotNull(PMA_cacheGet('test_data_2', 'server'));
- $this->assertNull(PMA_cacheGet('fake_data_2', true));
- }
-
- /**
- * Test retrieval of cached data
- */
- public function testCacheSetGet()
- {
- $GLOBALS['server'] = 'server';
- PMA_cacheSet('test_data', 25, true);
-
- PMA_cacheSet('test_data', 5, true);
- $this->assertEquals(5, $_SESSION['cache']['server_server']['test_data']);
- PMA_cacheSet('test_data_3', 3, true);
- $this->assertEquals(3, $_SESSION['cache']['server_server']['test_data_3']);
- }
-
- /**
- * Test clearing cached values
- */
- public function testCacheUnSet()
- {
- $GLOBALS['server'] = 'server';
- PMA_cacheSet('test_data', 25, true);
- PMA_cacheSet('test_data_2', 25, true);
-
- PMA_cacheUnset('test_data', true);
- $this->assertArrayNotHasKey('test_data', $_SESSION['cache']['server_server']);
- PMA_cacheUnset('test_data_2', true);
- $this->assertArrayNotHasKey('test_data_2', $_SESSION['cache']['server_server']);
- }
-}
-?>
diff --git a/test/PMA_escapeJsString_test.php b/test/PMA_escapeJsString_test.php
deleted file mode 100644
index 4efd633..0000000
--- a/test/PMA_escapeJsString_test.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Test for javascript escaping.
- *
- * @package phpMyAdmin-test
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-
-/**
- * Include to test.
- */
-require_once './libraries/js_escape.lib.php';
-
-/**
- * Test java script escaping.
- *
- * @package phpMyAdmin-test
- */
-class PMA_escapeJsString_test extends PHPUnit_Framework_TestCase
-{
- public function testEscape_1()
- {
- $this->assertEquals('\\\';', PMA_escapeJsString('\';'));
- }
-
- public function testEscape_2()
- {
- $this->assertEquals('\r\n\\\'<scrIpt></\' + \'script>', PMA_escapeJsString("\r\n'<scrIpt></sCRIPT>"));
- }
-
- public function testEscape_3()
- {
- $this->assertEquals('\\\';[XSS]', PMA_escapeJsString('\';[XSS]'));
- }
-
- public function testEscape_4()
- {
- $this->assertEquals('</\' + \'script></head><body>[HTML]', PMA_escapeJsString('</SCRIPT></head><body>[HTML]'));
- }
-
- public function testEscape_5()
- {
- $this->assertEquals('"\\\'\\\\\\\'"', PMA_escapeJsString('"\'\\\'"'));
- }
-
- public function testEscape_6()
- {
- $this->assertEquals("\\\\\'\'\'\'\'\'\'\'\'\'\'\'\\\\", PMA_escapeJsString("\\''''''''''''\\"));
- }
-
-}
-?>
diff --git a/test/PMA_escapeMySqlWildcards_test.php b/test/PMA_escapeMySqlWildcards_test.php
deleted file mode 100644
index ccdf15b..0000000
--- a/test/PMA_escapeMySqlWildcards_test.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Test for MySQL Wildcards escaping/unescaping
- *
- * @package phpMyAdmin-test
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-
-/**
- * Include to test.
- */
-require_once './libraries/common.lib.php';
-
-/**
- * Test MySQL escaping.
- *
- */
-class PMA_escapeMySqlWildcards_test extends PHPUnit_Framework_TestCase
-{
-
- public function escapeDataProvider() {
- return array(
- array('\_test', '_test'),
- array('\_\\', '_\\'),
- array('\\_\%', '_%'),
- array('\\\_', '\_'),
- array('\\\_\\\%', '\_\%'),
- array('\_\\%\_\_\%', '_%__%'),
- array('\%\_', '%_'),
- array('\\\%\\\_', '\%\_')
- );
- }
-
- /**
- * PMA_escape_mysql_wildcards tests
- * @dataProvider escapeDataProvider
- */
-
- public function testEscape($a, $b)
- {
- $this->assertEquals($a, PMA_escape_mysql_wildcards($b));
- }
-
- /**
- * PMA_unescape_mysql_wildcards tests
- * @dataProvider escapeDataProvider
- */
-
- public function testUnEscape($a, $b)
- {
- $this->assertEquals($b, PMA_unescape_mysql_wildcards($a));
- }
-}
-?>
diff --git a/test/PMA_foreignKeySupported_test.php b/test/PMA_foreignKeySupported_test.php
deleted file mode 100644
index f00afca..0000000
--- a/test/PMA_foreignKeySupported_test.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Test for supporting foreign key
- *
- * @package phpMyAdmin-test
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-
-/**
- * Include to test.
- */
-require_once './libraries/common.lib.php';
-
-/**
- * Test supported foreign key.
- *
- */
-class PMA_foreignKeySupported_test extends PHPUnit_Framework_TestCase
-{
- /**
- * data provider for foreign key supported test
- */
-
- public function foreignkeySupportedDataProvider() {
- return array(
- array('MyISAM', false),
- array('innodb', true),
- array('pBxT', true)
- );
- }
-
- /**
- * foreign key supported test
- * @dataProvider foreignkeySupportedDataProvider
- */
-
- public function testForeignkeySupported($a, $e) {
- $this->assertEquals($e, PMA_foreignkey_supported($a));
- }
-}
-?>
diff --git a/test/PMA_formatNumberByteDown_test.php b/test/PMA_formatNumberByteDown_test.php
deleted file mode 100644
index 1bc3d06..0000000
--- a/test/PMA_formatNumberByteDown_test.php
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Test for format number and byte
- *
- * @package phpMyAdmin-test
- * @version $Id: PMA_formatNumberByteDown_test.php
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-
-/**
- * Include to test.
- */
-require_once './libraries/common.lib.php';
-
-/**
- * Test formating number and byte.
- *
- */
-class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase
-{
-
- /**
- * temporary variable for globals array
- */
-
- protected $tmpGlobals;
-
- /**
- * temporary variable for session array
- */
-
- protected $tmpSession;
-
- /**
- * storing globals and session
- */
- public function setUp() {
-
- $this->tmpGlobals = $GLOBALS;
- $this->tmpSession = $_SESSION;
-
- }
-
- /**
- * recovering globals and session
- */
- public function tearDown() {
-
- $GLOBALS = $this->tmpGlobals;
- $_SESSION = $this->tmpSession;
-
- }
-
- /**
- * format number data provider
- */
-
- public function formatNumberDataProvider() {
- return array(
- array(10, 2, 2, '10,00 '),
- array(100, 2, 0, '100 '),
- array(100, 2, 2, '0,10 k'),
- array(-1000.454, 4, 2, '-1 000,45 '),
- array(0.00003, 3, 2, '0,03 m'),
- array(0.003, 3, 3, '0,003 '),
- array(-0.003, 6, 0, '-3 m'),
- array(100.98, 0, 2, '100,98')
- );
- }
-
- /**
- * format number test, globals are defined
- * @dataProvider formatNumberDataProvider
- */
-
- public function testFormatNumber($a, $b, $c, $e) {
- $this->assertEquals($e, (string)PMA_formatNumber($a, $b, $c, false));
- }
-
- /**
- * format byte down data provider
- */
-
- public function formatByteDownDataProvider() {
- return array(
- array(10, 2, 2, array('10', 'B')),
- array(100, 2, 0, array('0', 'KB')),
- array(100, 3, 0, array('100', 'B')),
- array(100, 2, 2, array('0,10', 'KB')),
- array(1034, 3, 2, array('1,01', 'KB')),
- array(100233, 3, 3, array('97,884', 'KB')),
- array(2206451, 1, 2, array('2,10', 'MB'))
- );
- }
-
- /**
- * format byte test, globals are defined
- * @dataProvider formatByteDownDataProvider
- */
-
- public function testFormatByteDown($a, $b, $c, $e) {
- $result = PMA_formatByteDown($a, $b, $c);
- $result[0] = trim($result[0]);
- $this->assertEquals($e, $result);
- }
-}
-?>
diff --git a/test/PMA_generateCommonUrl_test.php b/test/PMA_generateCommonUrl_test.php
deleted file mode 100644
index 22e948b..0000000
--- a/test/PMA_generateCommonUrl_test.php
+++ /dev/null
@@ -1,146 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * tests for PMA_generate_common_url()
- *
- * @package phpMyAdmin-test
- */
-
-/**
- *
- */
-require_once 'PHPUnit/Framework.php';
-require_once './libraries/core.lib.php';
-require_once './libraries/url_generating.lib.php';
-
-/**
- * @package phpMyAdmin-test
- */
-class PMA_generate_common_url_test extends PHPUnit_Framework_TestCase
-{
- public function setUp()
- {
- unset($_COOKIE['pma_lang'], $_COOKIE['pma_collation_connection']);
- }
-
- public function testOldStyle()
- {
- $GLOBALS['server'] = 'x';
- $GLOBALS['lang'] = 'x';
- $GLOBALS['collation_connection'] = 'x';
- $_SESSION[' PMA_token '] = 'x';
- $GLOBALS['cfg']['ServerDefault'] = 'y';
-
- $separator = PMA_get_arg_separator();
- $expected = 'server=x' . htmlentities($separator)
- . 'lang=x' . htmlentities($separator)
- . 'collation_connection=x' . htmlentities($separator)
- . 'token=x'
- ;
-
- $expected = 'db=db'
- . htmlentities($separator) . 'table=table'
- . htmlentities($separator) . $expected;
-
- $this->assertEquals($expected, PMA_generate_common_url('db', 'table'));
- }
-
- public function testOldStyleDbOnly()
- {
- $GLOBALS['server'] = 'x';
- $GLOBALS['lang'] = 'x';
- $GLOBALS['collation_connection'] = 'x';
- $_SESSION[' PMA_token '] = 'x';
- $GLOBALS['cfg']['ServerDefault'] = 'y';
-
- $separator = PMA_get_arg_separator();
- $expected = 'server=x' . htmlentities($separator)
- . 'lang=x' . htmlentities($separator)
- . 'collation_connection=x' . htmlentities($separator)
- . 'token=x'
- ;
-
- $expected = 'db=db'
- . htmlentities($separator) . $expected;
-
- $this->assertEquals($expected, PMA_generate_common_url('db'));
- }
-
- public function testNewStyle()
- {
- $GLOBALS['server'] = 'x';
- $GLOBALS['lang'] = 'x';
- $GLOBALS['collation_connection'] = 'x';
- $_SESSION[' PMA_token '] = 'x';
- $GLOBALS['cfg']['ServerDefault'] = 'y';
-
- $separator = PMA_get_arg_separator();
- $expected = 'server=x' . htmlentities($separator)
- . 'lang=x' . htmlentities($separator)
- . 'collation_connection=x' . htmlentities($separator)
- . 'token=x'
- ;
-
- $expected = '?db=db'
- . htmlentities($separator) . 'table=table'
- . htmlentities($separator) . $expected;
- $params = array('db' => 'db', 'table' => 'table');
- $this->assertEquals($expected, PMA_generate_common_url($params));
- }
-
- public function testOldStyleWithAlternateSeparator()
- {
- $GLOBALS['server'] = 'x';
- $GLOBALS['lang'] = 'x';
- $GLOBALS['collation_connection'] = 'x';
- $_SESSION[' PMA_token '] = 'x';
- $GLOBALS['cfg']['ServerDefault'] = 'y';
-
- $separator = PMA_get_arg_separator();
- $expected = 'server=x' . $separator
- . 'lang=x' . $separator
- . 'collation_connection=x' . $separator
- . 'token=x'
- ;
-
- $expected = 'db=db' . $separator . 'table=table' . $separator . $expected;
- $this->assertEquals($expected, PMA_generate_common_url('db', 'table', '&'));
- }
-
- public function testOldStyleWithAlternateSeparatorDbOnly()
- {
- $GLOBALS['server'] = 'x';
- $GLOBALS['lang'] = 'x';
- $GLOBALS['collation_connection'] = 'x';
- $_SESSION[' PMA_token '] = 'x';
- $GLOBALS['cfg']['ServerDefault'] = 'y';
-
- $separator = PMA_get_arg_separator();
- $expected = 'server=x' . $separator
- . 'lang=x' . $separator
- . 'collation_connection=x' . $separator
- . 'token=x'
- ;
-
- $expected = 'db=db' . $separator . $expected;
- $this->assertEquals($expected, PMA_generate_common_url('db', '', '&'));
- }
-
- public function testDefault()
- {
- $GLOBALS['server'] = 'x';
- $GLOBALS['lang'] = 'x';
- $GLOBALS['collation_connection'] = 'x';
- $_SESSION[' PMA_token '] = 'x';
- $GLOBALS['cfg']['ServerDefault'] = 'y';
-
- $separator = PMA_get_arg_separator();
- $expected = 'server=x' . htmlentities($separator)
- . 'lang=x' . htmlentities($separator)
- . 'collation_connection=x' . htmlentities($separator)
- . 'token=x'
- ;
- $this->assertEquals($expected, PMA_generate_common_url());
- }
-}
-?>
diff --git a/test/PMA_get_real_size_test.php b/test/PMA_get_real_size_test.php
deleted file mode 100644
index 14d2a61..0000000
--- a/test/PMA_get_real_size_test.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * tests for PMA_get_real_size()
- *
- * @package phpMyAdmin-test
- */
-
-/**
- *
- */
-require_once 'PHPUnit/Framework.php';
-require_once './libraries/core.lib.php';
-
-/**
- * @package phpMyAdmin-test
- */
-class PMA_get_real_size_test extends PHPUnit_Framework_TestCase
-{
- public function testNull()
- {
- $this->assertEquals(0, PMA_get_real_size('0'));
- }
-
- public function testKilobyte()
- {
- $this->assertEquals(1024, PMA_get_real_size('1kb'));
- }
-
- public function testKilobyte2()
- {
- $this->assertEquals(1024 * 1024, PMA_get_real_size('1024k'));
- }
-
- public function testMegabyte()
- {
- $this->assertEquals(8 * 1024 * 1024, PMA_get_real_size('8m'));
- }
-
- public function testGigabyte()
- {
- $this->assertEquals(12 * 1024 * 1024 * 1024, PMA_get_real_size('12gb'));
- }
-}
-?>
diff --git a/test/PMA_headerLocation_test.php b/test/PMA_headerLocation_test.php
deleted file mode 100644
index daad689..0000000
--- a/test/PMA_headerLocation_test.php
+++ /dev/null
@@ -1,304 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Test for PMA_sendHeaderLocation
- *
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-require_once 'PHPUnit/Extensions/OutputTestCase.php';
-
-/**
- * Include to test.
- */
-require_once './libraries/common.lib.php';
-require_once './libraries/url_generating.lib.php';
-require_once './libraries/core.lib.php';
-require_once './libraries/select_lang.lib.php';
-
-/**
- * Test function sending headers.
- * Warning - these tests set constants, so it can interfere with other tests
- * If you have runkit extension, then it is possible to back changes made on constants
- * rest of options can be tested only with apd, when functions header and headers_sent are redefined
- * rename_function() of header and headers_sent may cause CLI error report in Windows XP (but tests are done correctly)
- * additional functions which were created during tests must be stored to coverage test e.g.
- *
- * <code>rename_function('headers_sent', 'headers_sent'.str_replace(array('.', ' '),array('', ''),microtime()));</code>
- *
- * @package phpMyAdmin-test
- */
-
-class PMA_headerLocation_test extends PHPUnit_Extensions_OutputTestCase
-{
-
- protected $oldIISvalue;
- protected $oldSIDvalue;
- protected $runkitExt;
- protected $apdExt;
-
-
-
- public function __construct()
- {
- parent::__construct();
- $this->runkitExt = false;
- if (function_exists("runkit_constant_redefine"))
- $this->runkitExt = true;
-
- $this->apdExt = false;
- if (function_exists("rename_function"))
- $this->apdExt = true;
-
-
- if ($this->apdExt && !$GLOBALS['test_header']) {
-
- // using apd extension to overriding header and headers_sent functions for test purposes
- $GLOBALS['test_header'] = 1;
-
- // rename_function() of header and headers_sent may cause CLI error report in Windows XP
- rename_function('header', 'test_header');
- rename_function('headers_sent', 'test_headers_sent');
-
- // solution from: http://unixwars.com/2008/11/29/override_function-in-php/ to overriding more than one function
-
- $substs = array(
- 'header' => 'if (isset($GLOBALS["header"])) $GLOBALS["header"] .= $a; else $GLOBALS["header"] = $a;',
- 'headers_sent' => 'return false;'
- );
-
- $args = array(
- 'header' => '$a',
- 'headers_sent' => ''
- );
-
- foreach ($substs as $func => $ren_func) {
- if (function_exists("__overridden__"))
- rename_function("__overridden__", str_replace(array('.', ' '),array('', ''),microtime()));
- override_function($func, $args[$func], $substs[$func]);
- rename_function("__overridden__", str_replace(array('.', ' '),array('', ''),microtime()));
- }
-
- }
- }
-
- public function __destruct()
- {
- // rename_function may causes CLI error report in Windows XP, but nothing more happen
-
- if ($this->apdExt && $GLOBALS['test_header']) {
- $GLOBALS['test_header'] = 0;
-
- rename_function('header', 'header'.str_replace(array('.', ' '),array('', ''),microtime()));
- rename_function('headers_sent', 'headers_sent'.str_replace(array('.', ' '),array('', ''),microtime()));
-
- rename_function('test_header', 'header');
- rename_function('test_headers_sent', 'headers_sent');
- }
- }
-
- public function setUp()
- {
- // cleaning constants
- if ($this->runkitExt) {
-
- $this->oldIISvalue = 'non-defined';
-
- if (defined('PMA_IS_IIS')) {
- $this->oldIISvalue = PMA_IS_IIS;
- runkit_constant_redefine('PMA_IS_IIS', NULL);
- }
- else {
- runkit_constant_add('PMA_IS_IIS', NULL);
- }
-
-
- $this->oldSIDvalue = 'non-defined';
-
- if (defined('SID')) {
- $this->oldSIDvalue = SID;
- runkit_constant_redefine('SID', NULL);
- }
- else {
- runkit_constant_add('SID', NULL);
- }
-
- }
- }
-
-
- public function tearDown()
- {
- // cleaning constants
- if ($this->runkitExt) {
-
- if ($this->oldIISvalue != 'non-defined')
- runkit_constant_redefine('PMA_IS_IIS', $this->oldIISvalue);
- elseif (defined('PMA_IS_IIS')) {
- runkit_constant_remove('PMA_IS_IIS');
- }
-
- if ($this->oldSIDvalue != 'non-defined')
- runkit_constant_redefine('SID', $this->oldSIDvalue);
- elseif (defined('SID')) {
- runkit_constant_remove('SID');
- }
- }
-
- if ($this->apdExt)
- unset($GLOBALS['header']);
-
- }
-
-
- public function testSendHeaderLocationWithSidUrlWithQuestionMark()
- {
- if ($this->runkitExt && $this->apdExt) {
-
- runkit_constant_redefine('SID', md5('test_hash'));
-
- $testUri = 'http://testurl.com/test.php?test=test';
- $separator = PMA_get_arg_separator();
-
- $header = 'Location: ' . $testUri . $separator . SID;
-
- PMA_sendHeaderLocation($testUri); // sets $GLOBALS['header']
- $this->assertEquals($header, $GLOBALS['header']);
-
- } else {
- $this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
- }
-
- }
-
- public function testSendHeaderLocationWithSidUrlWithoutQuestionMark()
- {
- if ($this->runkitExt && $this->apdExt) {
-
- runkit_constant_redefine('SID', md5('test_hash'));
-
- $testUri = 'http://testurl.com/test.php';
- $separator = PMA_get_arg_separator();
-
- $header = 'Location: ' . $testUri . '?' . SID;
-
- PMA_sendHeaderLocation($testUri); // sets $GLOBALS['header']
- $this->assertEquals($header, $GLOBALS['header']);
-
- } else {
- $this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
- }
-
- }
-
- public function testSendHeaderLocationWithoutSidWithIis()
- {
- if ($this->runkitExt && $this->apdExt) {
-
- runkit_constant_redefine('PMA_IS_IIS', true);
- runkit_constant_add('PMA_COMING_FROM_COOKIE_LOGIN', true);
-
- $testUri = 'http://testurl.com/test.php';
- $separator = PMA_get_arg_separator();
-
- $header = 'Refresh: 0; ' . $testUri;
-
- PMA_sendHeaderLocation($testUri); // sets $GLOBALS['header']
-
- // cleaning constant
- runkit_constant_remove('PMA_COMING_FROM_COOKIE_LOGIN');
-
- $this->assertEquals($header, $GLOBALS['header']);
-
- } else {
- $this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
- }
-
- }
-
- public function testSendHeaderLocationWithoutSidWithoutIis()
- {
- if ($this->apdExt) {
-
- $testUri = 'http://testurl.com/test.php';
- $header = 'Location: ' . $testUri;
-
- PMA_sendHeaderLocation($testUri); // sets $GLOBALS['header']
- $this->assertEquals($header, $GLOBALS['header']);
-
- } else {
- $this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
- }
-
- }
-
- public function testSendHeaderLocationIisLongUri()
- {
- if (defined('PMA_IS_IIS') && $this->runkitExt)
- runkit_constant_redefine('PMA_IS_IIS', true);
- elseif (!defined('PMA_IS_IIS'))
- define('PMA_IS_IIS', true);
- else
- $this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
-
-
- // over 600 chars
- $testUri = 'http://testurl.com/test.php?testlonguri=over600chars&test=test&test=test&te…';
- $testUri_html = htmlspecialchars($testUri);
- $testUri_js = PMA_escapeJsString($testUri);
-
- $header = "<html><head><title>- - -</title>\n" .
- "<meta http-equiv=\"expires\" content=\"0\">\n" .
- "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n" .
- "<meta http-equiv=\"Cache-Control\" content=\"no-cache\">\n" .
- "<meta http-equiv=\"Refresh\" content=\"0;url=" . $testUri_html . "\">\n" .
- "<script type=\"text/javascript\">\n".
- "//<![CDATA[\n" .
- "setTimeout(\"window.location = unescape('\"" . $testUri_js . "\"')\", 2000);\n" .
- "//]]>\n" .
- "</script>\n" .
- "</head>\n" .
- "<body>\n" .
- "<script type=\"text/javascript\">\n" .
- "//<![CDATA[\n" .
- "document.write('<p><a href=\"" . $testUri_html . "\">" . 'test link' . "</a></p>');\n" .
- "//]]>\n" .
- "</script></body></html>\n";
-
-
- $this->expectOutputString($header);
-
- PMA_sendHeaderLocation($testUri);
- }
-
- /**
- * other output tests
- */
-
- public function testWriteReloadNavigation()
- {
- $GLOBALS['reload'] = true;
- $GLOBALS['db'] = 'test_db';
-
- $url = './navigation.php?db='.$GLOBALS['db'] . '&lang=en-utf-8&convcharset=utf-8';
- $write = PHP_EOL . '<script type="text/javascript">' . PHP_EOL .
- '//<![CDATA[' . PHP_EOL .
- 'if (typeof(window.parent) != \'undefined\'' . PHP_EOL .
- ' && typeof(window.parent.frame_navigation) != \'undefined\'' . PHP_EOL .
- ' && window.parent.goTo) {' . PHP_EOL .
- ' window.parent.goTo(\'' . $url . '\');' . PHP_EOL .
- '}' . PHP_EOL .
- '//]]>' . PHP_EOL .
- '</script>' . PHP_EOL;
-
- $this->expectOutputString($write);
- PMA_reloadNavigation();
-
- $this->assertFalse(isset($GLOBALS['reload']));
- unset($GLOBALS['db']);
- }
-}
-?>
diff --git a/test/PMA_ifSetOr_test.php b/test/PMA_ifSetOr_test.php
deleted file mode 100644
index fbeb80e..0000000
--- a/test/PMA_ifSetOr_test.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * tests for PMA_ifSetOr()
- *
- * @package phpMyAdmin-test
- */
-
-/**
- *
- */
-require_once 'PHPUnit/Framework.php';
-require_once './libraries/core.lib.php';
-
-/**
- * @package phpMyAdmin-test
- */
-class PMA_ifSetOr_test extends PHPUnit_Framework_TestCase
-{
- public function testVarSet()
- {
- $default = 'foo';
- $in = 'bar';
- $out = PMA_ifSetOr($in, $default);
- $this->assertEquals($in, $out);
- }
- public function testVarSetWrongType()
- {
- $default = 'foo';
- $in = 'bar';
- $out = PMA_ifSetOr($in, $default, 'boolean');
- $this->assertEquals($out, $default);
- }
- public function testVarNotSet()
- {
- $default = 'foo';
- // $in is not set!
- $out = PMA_ifSetOr($in, $default);
- $this->assertEquals($out, $default);
- }
- public function testVarNotSetNoDefault()
- {
- // $in is not set!
- $out = PMA_ifSetOr($in);
- $this->assertEquals($out, null);
- }
-
-}
-?>
diff --git a/test/PMA_isValid_test.php b/test/PMA_isValid_test.php
deleted file mode 100644
index ffd41a2..0000000
--- a/test/PMA_isValid_test.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * tests for PMA_pow()
- *
- * @package phpMyAdmin-test
- */
-
-/**
- *
- */
-require_once 'PHPUnit/Framework.php';
-require_once './libraries/core.lib.php';
-
-/**
- * @package phpMyAdmin-test
- */
-class PMA_isValid_test extends PHPUnit_Framework_TestCase
-{
- public function testVarNotSetAfterTest()
- {
- PMA_isValid($var);
- $this->assertFalse(isset($var));
- }
- public function testNotSet()
- {
- $this->assertFalse(PMA_isValid($var));
- }
- public function testEmptyString()
- {
- $var = '';
- $this->assertFalse(PMA_isValid($var));
- }
- public function testNotEmptyString()
- {
- $var = '0';
- $this->assertTrue(PMA_isValid($var));
- }
- public function testZero()
- {
- $var = 0;
- $this->assertTrue(PMA_isValid($var));
- }
- public function testNullFail()
- {
- $var = null;
- $this->assertFalse(PMA_isValid($var));
- }
- public function testNotSetArray()
- {
- $this->assertFalse(PMA_isValid($array['x']));
- }
- public function testScalarString()
- {
- $var = 'string';
- $this->assertTrue(PMA_isValid($var, 'scalar'));
- }
- public function testScalarInt()
- {
- $var = 1;
- $this->assertTrue(PMA_isValid($var, 'scalar'));
- }
- public function testScalarFloat()
- {
- $var = 1.1;
- $this->assertTrue(PMA_isValid($var, 'scalar'));
- }
- public function testScalarBool()
- {
- $var = true;
- $this->assertTrue(PMA_isValid($var, 'scalar'));
- }
- public function testNotScalarArray()
- {
- $var = array('test');
- $this->assertFalse(PMA_isValid($var, 'scalar'));
- }
- public function testNotScalarNull()
- {
- $var = null;
- $this->assertFalse(PMA_isValid($var, 'scalar'));
- }
- public function testNumericInt()
- {
- $var = 1;
- $this->assertTrue(PMA_isValid($var, 'numeric'));
- }
- public function testNumericFloat()
- {
- $var = 1.1;
- $this->assertTrue(PMA_isValid($var, 'numeric'));
- }
- public function testNumericZero()
- {
- $var = 0;
- $this->assertTrue(PMA_isValid($var, 'numeric'));
- }
- public function testNumericString()
- {
- $var = '+0.1';
- $this->assertTrue(PMA_isValid($var, 'numeric'));
- }
- public function testValueInArray()
- {
- $var = 'a';
- $this->assertTrue(PMA_isValid($var, array('a', 'b', )));
- }
- public function testValueNotInArray()
- {
- $var = 'c';
- $this->assertFalse(PMA_isValid($var, array('a', 'b', )));
- }
-}
-?>
diff --git a/test/PMA_localisedDateTimespan_test.php b/test/PMA_localisedDateTimespan_test.php
deleted file mode 100644
index e472373..0000000
--- a/test/PMA_localisedDateTimespan_test.php
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Test for generating localised date or timespan expression
- *
- * @package phpMyAdmin-test
- * @version $Id: PMA_localisedDateTimespan_test.php
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-
-/**
- * Include to test.
- */
-require_once './libraries/common.lib.php';
-
-/**
- * Test localised date or timespan expression.
- *
- */
-class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase
-{
-
- /**
- * temporary variable for globals array
- */
-
- protected $tmpGlobals;
-
- /**
- * temporary variable for session array
- */
-
- protected $tmpSession;
-
- /**
- * temporary variable for timezone info
- */
-
- protected $tmpTimezone;
-
- /**
- * storing globals and session
- */
- public function setUp() {
-
- $this->tmpGlobals = $GLOBALS;
- $this->tmpSession = $_SESSION;
- $this->tmpTimezone = date_default_timezone_get();
- date_default_timezone_set('Europe/London');
- }
-
- /**
- * recovering globals and session
- */
- public function tearDown() {
-
- $GLOBALS = $this->tmpGlobals;
- $_SESSION = $this->tmpSession;
- date_default_timezone_set($this->tmpTimezone);
-
- }
-
- /**
- * data provider for localised date test
- */
-
- public function localisedDateDataProvider() {
- return array(
- array(1227455558, '', 'Nov 23, 2008 at 03:52 PM'),
- array(1227455558, '%Y-%m-%d %H:%M:%S %a', '2008-11-23 15:52:38 Sun')
- );
- }
-
- /**
- * localised date test, globals are defined
- * @dataProvider localisedDateDataProvider
- */
-
- public function testLocalisedDate($a, $b, $e) {
- $this->assertEquals($e, PMA_localisedDate($a, $b));
- }
-
- /**
- * data provider for localised timestamp test
- */
-
- public function timespanFormatDataProvider() {
- return array(
- array(1258, '0 days, 0 hours, 20 minutes and 58 seconds'),
- array(821958, '9 days, 12 hours, 19 minutes and 18 seconds')
- );
- }
-
- /**
- * localised timestamp test, globals are defined
- * @dataProvider timespanFormatDataProvider
- */
-
- public function testTimespanFormat($a, $e) {
- $GLOBALS['timespanfmt'] = '%s days, %s hours, %s minutes and %s seconds';
-
- $this->assertEquals($e, PMA_timespanFormat($a));
- }
-}
-?>
diff --git a/test/PMA_pow_test.php b/test/PMA_pow_test.php
deleted file mode 100644
index cb62e52..0000000
--- a/test/PMA_pow_test.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * tests for PMA_pow()
- *
- * @package phpMyAdmin-test
- */
-
-/**
- *
- */
-require_once 'PHPUnit/Framework.php';
-require_once './libraries/common.lib.php';
-
-/**
- * @package phpMyAdmin-test
- */
-class PMA_pow_test extends PHPUnit_Framework_TestCase
-{
- public function testIntOverflow()
- {
- $this->assertEquals('1267650600228229401496703205376',
- PMA_pow(2, 100));
- }
-
- public function testBcpow()
- {
- if (function_exists('bcpow')) {
- $this->assertEquals('1267650600228229401496703205376',
- PMA_pow(2, 100, 'bcpow'));
- } else {
- $this->markTestSkipped('function bcpow() does not exist');
- }
- }
-
- public function testGmppow()
- {
- if (function_exists('gmp_pow')) {
- $this->assertEquals('1267650600228229401496703205376',
- PMA_pow(2, 100, 'gmp_pow'));
- } else {
- $this->markTestSkipped('function gmp_pow() does not exist');
- }
- }
-
- public function _testNegativeExp()
- {
- $this->assertEquals(0.25,
- PMA_pow(2, -2));
- }
-
- public function _testNegativeExpPow()
- {
- if (function_exists('pow')) {
- $this->assertEquals(0.25,
- PMA_pow(2, -2, 'pow'));
- } else {
- $this->markTestSkipped('function pow() does not exist');
- }
- }
-
- public function _testNegativeExpBcpow()
- {
- if (function_exists('bcpow')) {
- $this->assertEquals(0.25,
- PMA_pow(2, -2, 'bcpow'));
- } else {
- $this->markTestSkipped('function bcpow() does not exist');
- }
- }
-
- public function _testNegativeExpGmppow()
- {
- if (function_exists('gmp_pow')) {
- $this->assertEquals(0.25,
- PMA_pow(2, -2, 'gmp_pow'));
- } else {
- $this->markTestSkipped('function gmp_pow() does not exist');
- }
- }
-}
-?>
diff --git a/test/PMA_printableBitValue_test.php b/test/PMA_printableBitValue_test.php
deleted file mode 100644
index 9351eb8..0000000
--- a/test/PMA_printableBitValue_test.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Test printableBitValue function
- *
- * @package phpMyAdmin-test
- * @version $Id: PMA_printableBitValue_test.php
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-
-/**
- * Include to test.
- */
-require_once './libraries/common.lib.php';
-
-/**
- * Test printableBitValue function.
- *
- */
-class PMA_printableBitValue_test extends PHPUnit_Framework_TestCase
-{
-
- /**
- * data provider for printable bit value test
- */
-
- public function printableBitValueDataProvider() {
- return array(
- array('testtest', 64, '0111010001100101011100110111010001110100011001010111001101110100'),
- array('test', 32, '01110100011001010111001101110100')
- );
- }
-
- /**
- * test for generating string contains printable bit value of selected data
- * @dataProvider printableBitValueDataProvider
- */
-
- public function testPrintableBitValue($a, $b, $e) {
- $this->assertEquals($e, PMA_printable_bit_value($a, $b));
- }
-}
-?>
diff --git a/test/PMA_quoting_slashing_test.php b/test/PMA_quoting_slashing_test.php
deleted file mode 100644
index c918390..0000000
--- a/test/PMA_quoting_slashing_test.php
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Test for quoting, slashing/backslashing
- *
- * @package phpMyAdmin-test
- * @version $Id: PMA_quoting_slashing_test.php
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-
-/**
- * Include to test.
- */
-require_once './libraries/common.lib.php';
-
-/**
- * Test quoting, slashing, backslashing.
- *
- */
-class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
-{
-
- /**
- * sqlAddslashes test
- */
-
- public function testAddSlashes() {
- $string = "\'test''\''\'\r\t\n";
-
- $this->assertEquals("\\\\\\\\\'test\'\'\\\\\\\\\'\'\\\\\\\\\'\\r\\t\\n", PMA_sqlAddSlashes($string, true, true, true));
- $this->assertEquals("\\\\\\\\''test''''\\\\\\\\''''\\\\\\\\''\\r\\t\\n", PMA_sqlAddSlashes($string, true, true, false));
- $this->assertEquals("\\\\\\\\\'test\'\'\\\\\\\\\'\'\\\\\\\\\'\r\t\n", PMA_sqlAddSlashes($string, true, false, true));
- $this->assertEquals("\\\\\\\\''test''''\\\\\\\\''''\\\\\\\\''\r\t\n", PMA_sqlAddSlashes($string, true, false, false));
- $this->assertEquals("\\\\\'test\'\'\\\\\'\'\\\\\'\\r\\t\\n", PMA_sqlAddSlashes($string, false, true, true));
- $this->assertEquals("\\\\''test''''\\\\''''\\\\''\\r\\t\\n", PMA_sqlAddSlashes($string, false, true, false));
- $this->assertEquals("\\\\\'test\'\'\\\\\'\'\\\\\'\r\t\n", PMA_sqlAddSlashes($string, false, false, true));
- $this->assertEquals("\\\\''test''''\\\\''''\\\\''\r\t\n", PMA_sqlAddSlashes($string, false, false, false));
- }
-
- /**
- * data provider for unQuote test
- */
-
- public function unQuoteProvider() {
- return array(
- array('"test\'"', "test'"),
- array("'test''", "test'"),
- array("`test'`", "test'"),
- array("'test'test", "'test'test")
- );
- }
-
- /**
- * unQuote test
- * @dataProvider unQuoteProvider
- */
-
- public function testUnQuote($param, $expected) {
- $this->assertEquals($expected, PMA_unQuote($param));
- }
-
- /**
- * data provider for unQuote test with chosen quote
- */
-
- public function unQuoteSelectedProvider() {
- return array(
- array('"test\'"', "test'"),
- array("'test''", "'test''"),
- array("`test'`", "`test'`"),
- array("'test'test", "'test'test")
- );
- }
-
- /**
- * unQuote test with chosen quote
- * @dataProvider unQuoteSelectedProvider
- */
-
- public function testUnQuoteSelectedChar($param, $expected) {
- $this->assertEquals($expected, PMA_unQuote($param, '"'));
- }
-
- /**
- * data provider for backquote test
- */
-
- public function backquoteDataProvider() {
- return array(
- array('0', '`0`'),
- array('test', '`test`'),
- array('te`st', '`te``st`'),
- array(array('test', 'te`st', '', '*'), array('`test`', '`te``st`', '', '*'))
- );
- }
-
- /**
- * backquote test with different param $do_it (true, false)
- * @dataProvider backquoteDataProvider
- */
-
- public function testBackquote($a, $b) {
- $this->assertEquals($a, PMA_backquote($a, false));
- $this->assertEquals($b, PMA_backquote($a));
- }
-}
-?>
diff --git a/test/PMA_sanitize_test.php b/test/PMA_sanitize_test.php
deleted file mode 100644
index 1400c7e..0000000
--- a/test/PMA_sanitize_test.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * tests for PMA_sanitize()
- *
- * @package phpMyAdmin-test
- */
-
-/**
- *
- */
-require_once 'PHPUnit/Framework.php';
-require_once './libraries/sanitizing.lib.php';
-
-/**
- * @package phpMyAdmin-test
- */
-class PMA_sanitize_test extends PHPUnit_Framework_TestCase
-{
- public function testXssInHref()
- {
- $this->assertEquals('[a@javascript:alert(\'XSS\');@target]link</a>',
- PMA_sanitize('[a@javascript:alert(\'XSS\');@target]link[/a]'));
- }
-
- public function testLink()
- {
- $this->assertEquals('<a href="http://www.phpmyadmin.net/" target="target">link</a>',
- PMA_sanitize('[a@http://www.phpmyadmin.net/@target]link[/a]'));
- }
-
- public function testHtmlTags()
- {
- $this->assertEquals('<div onclick="">',
- PMA_sanitize('<div onclick="">'));
- }
-
- public function testBbcoe()
- {
- $this->assertEquals('<strong>strong</strong>',
- PMA_sanitize('[b]strong[/b]'));
- }
-}
-?>
diff --git a/test/PMA_showHint_test.php b/test/PMA_showHint_test.php
index 2ff37fe..8370759 100644
--- a/test/PMA_showHint_test.php
+++ b/test/PMA_showHint_test.php
@@ -1,26 +1,17 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
- * Test for showHint function
+ * Test for PMA_showHint() function from common.lib.php
*
* @package phpMyAdmin-test
* @version $Id: PMA_showHint_test.php
*/
/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-
-/**
* Include to test.
*/
-require_once './libraries/common.lib.php';
+require_once 'libraries/common.lib.php';
-/**
- * Test showHint function.
- *
- */
class PMA_showHint_test extends PHPUnit_Framework_TestCase
{
@@ -105,6 +96,7 @@ class PMA_showHint_test extends PHPUnit_Framework_TestCase
/**
* PMA_showHint with not defined GLOBALS formatted as BB
+ * @depends testShowHintSetting
*/
public function testShowHintSettingBbFormat()
{
diff --git a/test/PMA_stringOperations_test.php b/test/PMA_stringOperations_test.php
deleted file mode 100644
index 38aa26b..0000000
--- a/test/PMA_stringOperations_test.php
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Test for several string operations
- *
- * @version $Id: PMA_stringOperations_test.php
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-
-/**
- * Include to test.
- */
-require_once './libraries/common.lib.php';
-
-/**
- * Test string operations.
- * @package phpMyAdmin-test
- */
-class PMA_stringOperations_test extends PHPUnit_Framework_TestCase
-{
-
- /**
- * temporary variable for globals array
- */
-
- protected $tmpGlobals;
-
- /**
- * temporary variable for session array
- */
-
- protected $tmpSession;
-
- /**
- * storing globals and session
- */
- public function setUp() {
-
- $this->tmpGlobals = $GLOBALS;
- $this->tmpSession = $_SESSION;
-
- }
-
- /**
- * data provider for flipstring test
- */
-
- public function flipStringDataProvider() {
- return array(
- array('test', "t<br />\ne<br />\ns<br />\nt"),
- array('te ;st', "t<br />\ne<br />\n <br />\n;<br />\ns<br />\nt")
- );
- }
-
- /**
- * test of changing string from horizontal to vertical orientation
- * @dataProvider flipStringDataProvider
- */
-
- public function testFlipString($a, $e) {
- $this->assertEquals($e, PMA_flipstring($a));
- }
-
- /**
- * data provider for userDir test
- */
-
- public function userDirDataProvider() {
- return array(
- array('/var/pma_tmp/%u/', "/var/pma_tmp/root/"),
- array('/home/%u/pma', "/home/root/pma/")
- );
- }
-
- /**
- * test of generating user dir, globals are defined
- * @dataProvider userDirDataProvider
- */
-
- public function testUserDirString($a, $e) {
- $GLOBALS['cfg']['Server']['user'] = 'root';
-
- $this->assertEquals($e, PMA_userDir($a));
- }
-
- /**
- * data provider for replace binary content test
- */
-
- public function replaceBinaryContentsDataProvider() {
- return array(
- array("\x000", '\00'),
- array("\x08\x0a\x0d\x1atest", '\b\n\r\Ztest'),
- array("\ntest", '\ntest')
- );
- }
-
- /**
- * replace binary contents test
- * @dataProvider replaceBinaryContentsDataProvider
- */
-
- public function testReplaceBinaryContents($a, $e) {
- $this->assertEquals($e, PMA_replace_binary_contents($a));
- }
-
- /**
- * data provider for duplicate first newline test
- */
-
- public function duplicateFirstNewlineDataProvider() {
- return array(
- array('test', 'test'),
- array("\r\ntest", "\n\r\ntest"),
- array("\ntest", "\ntest"),
- array("\n\r\ntest", "\n\r\ntest")
- );
- }
-
- /**
- * duplicate first newline test
- * @dataProvider duplicateFirstNewlineDataProvider
- */
-
- public function testDuplicateFirstNewline($a, $e) {
- $this->assertEquals($e, PMA_duplicateFirstNewline($a));
- }
-
-}
-?>
diff --git a/test/PMA_transformation_getOptions_test.php b/test/PMA_transformation_getOptions_test.php
deleted file mode 100644
index 126a620..0000000
--- a/test/PMA_transformation_getOptions_test.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * tests for PMA_sanitize()
- *
- * @package phpMyAdmin-test
- */
-
-/**
- *
- */
-require_once 'PHPUnit/Framework.php';
-require_once './libraries/transformations.lib.php';
-
-/**
- * @package phpMyAdmin-test
- */
-class PMA_transformation_getOptions_test extends PHPUnit_Framework_TestCase
-{
- public function testDefault()
- {
- $this->assertEquals(array('option1 ', ' option2 '),
- PMA_transformation_getOptions("option1 , option2 "));
- }
-
- public function testQuoted()
- {
- $this->assertEquals(array('option1', ' option2'),
- PMA_transformation_getOptions("'option1' ,' option2' "));
- }
-
- public function testComma()
- {
- $this->assertEquals(array('2,3', ' ,, option ,,'),
- PMA_transformation_getOptions("'2,3' ,' ,, option ,,' "));
- }
-
- public function testEmptyOptions()
- {
- $this->assertEquals(array('', '', ''),
- PMA_transformation_getOptions("'',,"));
- }
-
- public function testEmpty()
- {
- $this->assertEquals(array(),
- PMA_transformation_getOptions(''));
- }
-}
-?>
diff --git a/test/PMA_whichCrlf_test.php b/test/PMA_whichCrlf_test.php
deleted file mode 100644
index 244b548..0000000
--- a/test/PMA_whichCrlf_test.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Test whichCrlf function
- *
- * @package phpMyAdmin-test
- * @version $Id: PMA_whichCrlf_test.php
- */
-
-/**
- * Tests core.
- */
-require_once 'PHPUnit/Framework.php';
-
-/**
- * Include to test.
- */
-require_once './libraries/common.inc.php';
-
-/**
- * Test whichCrlf function.
- *
- */
-class PMA_whichCrlf_test extends PHPUnit_Framework_TestCase
-{
-
- /**
- * @using runkit pecl extension
- * if not define PMA_USR_OS, then define it as Win
- * if installed runkit, then constant will not change
- */
-
- public function testWhichCrlf()
- {
- $runkit = function_exists('runkit_constant_redefine');
- if ($runkit && defined('PMA_USR_OS'))
- $pma_usr_os = PMA_USR_OS;
-
- if (defined('PMA_USR_OS') && !$runkit) {
-
- if (PMA_USR_OS == 'Win')
- $this->assertEquals("\r\n", PMA_whichCrlf());
- else
- $this->assertEquals("\n", PMA_whichCrlf());
-
- $this->markTestIncomplete('Cannot redefine constant');
-
- } else {
-
- if ($runkit)
- define('PMA_USR_OS', 'Linux');
- $this->assertEquals("\n", PMA_whichCrlf());
-
- if ($runkit)
- runkit_constant_redefine('PMA_USR_OS', 'Win');
- else
- define('PMA_USR_OS', 'Win');
- $this->assertEquals("\r\n", PMA_whichCrlf());
-
- }
-
- if ($runkit) {
- if (isset($pma_usr_os))
- runkit_constant_redefine('PMA_USR_OS', 'Win');
- else
- runkit_constant_remove('PMA_USR_OS');
- }
- }
-
-}
-?>
diff --git a/test/PmaSeleniumLoginTest.php b/test/PmaSeleniumLoginTest.php
deleted file mode 100644
index 9c1be97..0000000
--- a/test/PmaSeleniumLoginTest.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Selenium TestCase for login related tests
- *
- * @package phpMyAdmin-test
- */
-
-require_once('PmaSeleniumTestCase.php');
-
-
-class PmaSeleniumLoginTest extends PmaSeleniumTestCase
-{
- public function testLogin()
- {
- $this->doLogin();
- $this->assertRegExp("/phpMyAdmin .*-dev/", $this->getTitle());
- }
-}
-?>
diff --git a/test/PmaSeleniumPrivilegesTest.php b/test/PmaSeleniumPrivilegesTest.php
deleted file mode 100644
index 64ff25d..0000000
--- a/test/PmaSeleniumPrivilegesTest.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Selenium TestCase for privilege related tests
- *
- * @package phpMyAdmin-test
- */
-
-require_once('PmaSeleniumTestCase.php');
-
-
-class PmaSeleniumPrivilegesTest extends PmaSeleniumTestCase
-{
- public function testChangePassword()
- {
- $this->doLogin();
- $this->selectFrame("frame_content");
- $this->click("link=Change password");
- $this->waitForPageToLoad("30000");
- try {
- $this->assertEquals("", $this->getValue("text_pma_pw"));
- } catch (PHPUnit_Framework_AssertionFailedError $e) {
- array_push($this->verificationErrors, $e->toString());
- }
- try {
- $this->assertEquals("", $this->getValue("text_pma_pw2"));
- } catch (PHPUnit_Framework_AssertionFailedError $e) {
- array_push($this->verificationErrors, $e->toString());
- }
- try {
- $this->assertEquals("", $this->getValue("generated_pw"));
- } catch (PHPUnit_Framework_AssertionFailedError $e) {
- array_push($this->verificationErrors, $e->toString());
- }
- $this->click("button_generate_password");
- $this->assertNotEquals("", $this->getValue("text_pma_pw"));
- $this->assertNotEquals("", $this->getValue("text_pma_pw2"));
- $this->assertNotEquals("", $this->getValue("generated_pw"));
- $this->type("text_pma_pw", $this->cfg['Test']['testuser']['password']);
- $this->type("text_pma_pw2", $this->cfg['Test']['testuser']['password']);
- $this->click("change_pw");
- $this->waitForPageToLoad("30000");
- $this->assertTrue($this->isTextPresent(""));
- $this->assertTrue($this->isTextPresent(""));
- }
-}
-?>
diff --git a/test/PmaSeleniumTestCase.php b/test/PmaSeleniumTestCase.php
deleted file mode 100644
index ac70594..0000000
--- a/test/PmaSeleniumTestCase.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Selenium parent class for TestCases
- *
- * @package phpMyAdmin-test
- */
-
-// Optionally add the php-client-driver to your include path
-set_include_path(get_include_path() . PATH_SEPARATOR . '/opt/selenium-remote-control-1.0.1/selenium-php-client-driver-1.0.1/PEAR/');
-
-require_once 'PHPUnit/Framework/TestCase.php';
-require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
-require_once 'Testing/Selenium.php';
-
-// Include the main phpMyAdmin user config
-// currently only $cfg['Test'] is used
-require_once '../config.inc.php';
-
-
-
-class PmaSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase
-{
- protected $selenium;
- protected $cfg;
-
- // TODO: find a way to get this from config.inc.php???
- // PHPUnit also has a way to use XML configuration... maybe we should use that
- public static $browsers = array(
- array(
-
- 'name' => 'Firefox on Windows XP',
- 'browser' => '*firefox',
- 'host' => 'my.windowsxp.box',
- 'port' => 4444,
- 'timeout' => 30000,
- ),
-
- array(
- 'name' => 'Internet Explorer on Windows XP',
- 'browser' => '*iexplore',
- 'host' => 'my.windowsxp.box',
- 'port' => 4444,
- 'timeout' => 30000,
- ),
-
- );
-
- public function setUp()
- {
- global $cfg;
- $this->cfg =& $cfg;
- //PHPUnit_Extensions_SeleniumTestCase::$browsers = $this->cfg['Test']['broswers'];
-
- // Check if the test configuration is available
- if ( empty($cfg['Test']['pma_host'])
- || empty($cfg['Test']['pma_url'])
- //|| empty($cfg['Test']['browsers'])
- ) {
- $this->fail("Missing Selenium configuration in config.inc.php"); // TODO add doc ref?
- }
-
- $this->setBrowserUrl($cfg['Test']['pma_host'] . $cfg['Test']['pma_url']);
-
- $this->start();
- }
-
- public function tearDown()
- {
- $this->stop();
- }
-
- /**
- * perform a login
- */
- public function doLogin()
- {
- $this->open($this->cfg['Test']['pma_url']);
- // Somehow selenium does not like the language selection on the cookie login page, forced English in the config for now.
- //$this->select("lang", "label=English");
-
- $this->waitForPageToLoad("30000");
- $this->type("input_username", $this->cfg['Test']['testuser']['username']);
- $this->type("input_password", $this->cfg['Test']['testuser']['password']);
- $this->click("input_go");
- $this->waitForPageToLoad("30001");
- }
-
- /*
- * Just a dummy to show some example statements
- *
- public function mockTest()
- {
- // Slow down the testing speed, ideal for debugging
- //$this->setSpeed(4000);
-}
- */
-}
-
-?>
diff --git a/test/PmaSeleniumXssTest.php b/test/PmaSeleniumXssTest.php
deleted file mode 100644
index 5099506..0000000
--- a/test/PmaSeleniumXssTest.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-/* vim: set expandtab sw=4 ts=4 sts=4: */
-/**
- * Selenium TestCase for XSS related tests
- *
- * @package phpMyAdmin-test
- */
-
-require_once('PmaSeleniumTestCase.php');
-
-class PmaSeleniumXSSTest extends PmaSeleniumTestCase
-{
- public function testXssQueryTab()
- {
- $this->doLogin();
- $this->selectFrame("frame_content");
- $this->click("link=SQL");
- $this->waitForPageToLoad("30000");
- $this->type("sqlquery", "'\"><script>alert(123);</script>");
- $this->click("SQL");
- // If an alert pops up the test fails, since we don't handle an alert.
- }
-}
-?>
diff --git a/test/README b/test/README
new file mode 100644
index 0000000..a7e287a
--- /dev/null
+++ b/test/README
@@ -0,0 +1,11 @@
+PhpMyAdmin test suite
+=====================
+
+This directory is protected from web visitors by a .htaccess file.
+
+For more information on allowing http access to this directory see:
+http://httpd.apache.org/docs/current/mod/mod_authz_host.html#allow
+
+Please visit the wiki for more information on unit testing:
+https://wiki.phpmyadmin.net/pma/UnitTesting
+
diff --git a/test/bootstrap-dist.php b/test/bootstrap-dist.php
new file mode 100644
index 0000000..fac9b27
--- /dev/null
+++ b/test/bootstrap-dist.php
@@ -0,0 +1,14 @@
+<?php
+
+// Adding phpMyAdmin sources to include path
+set_include_path(get_include_path() . PATH_SEPARATOR . dirname(realpath("../index.php")));
+
+// Setting constants for testing
+define('PHPMYADMIN', 1);
+define('TESTSUITE', 1);
+
+session_start();
+
+// You can put some additional code that should run before tests here
+
+?>
diff --git a/test/classes/PMA_Config_test.php b/test/classes/PMA_Config_test.php
new file mode 100644
index 0000000..3340957
--- /dev/null
+++ b/test/classes/PMA_Config_test.php
@@ -0,0 +1,613 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_Config class
+ *
+ *
+ * @package phpMyAdmin-test
+ * @group current
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/Config.class.php';
+require_once 'libraries/relation.lib.php';
+
+class PMA_ConfigTest extends PHPUnit_Framework_TestCase
+{
+ /**
+ * Turn off backup globals
+ */
+ protected $backupGlobals = FALSE;
+
+ /**
+ * @var PMA_Config
+ */
+ protected $object;
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ */
+ protected function setUp()
+ {
+ $this->object = new PMA_Config;
+ }
+
+ /**
+ * Tears down the fixture, for example, closes a network connection.
+ * This method is called after a test is executed.
+ */
+ protected function tearDown()
+ {
+ }
+
+ public function testCheckSystem()
+ {
+ $this->object->checkSystem();
+
+ $this->assertNotNull($this->object->get('PMA_VERSION'));
+ $this->assertNotEmpty($this->object->get('PMA_THEME_VERSION'));
+ $this->assertNotEmpty($this->object->get('PMA_THEME_GENERATION'));
+ }
+
+ public function testCheckOutputCompression()
+ {
+
+ $this->object->set('OBGzip', 'auto');
+
+ $this->object->set('PMA_USR_BROWSER_AGENT', 'IE');
+ $this->object->set('PMA_USR_BROWSER_VER', 6);
+ $this->object->checkOutputCompression();
+ $this->assertFalse($this->object->get("OBGzip"));
+
+ $this->object->set('OBGzip', 'auto');
+ $this->object->set('PMA_USR_BROWSER_AGENT', 'MOZILLA');
+ $this->object->set('PMA_USR_BROWSER_VER', 5);
+ $this->object->checkOutputCompression();
+ $this->assertEquals('auto',$this->object->get("OBGzip"));
+
+ ini_set('zlib.output_compression', 'Off');
+ $this->object->checkOutputCompression();
+ $this->assertFalse($this->object->get("OBGzip"));
+
+ ini_set('zlib.output_compression', 'On');
+ }
+
+ public function testCheckClient()
+ {
+ $_SERVER['HTTP_USER_AGENT'] = 'Opera/9.80 (X11; Linux x86_64; U; pl) Presto/2.7.62 Version/11.00';
+ $this->object->checkClient();
+ $this->assertEquals("Linux", $this->object->get('PMA_USR_OS'), "User OS expected to be Linux");
+ $this->assertEquals("OPERA", $this->object->get('PMA_USR_BROWSER_AGENT'), "Browser expected to be Opera");
+ $this->assertEquals("9.80", $this->object->get('PMA_USR_BROWSER_VER'), "Browser ver expected to be 9.80");
+
+ $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US) AppleWebKit/528.16 OmniWeb/622.8.0.112941';
+ $this->object->checkClient();
+ $this->assertEquals("Mac", $this->object->get('PMA_USR_OS'), "User OS expected to be Mac");
+ $this->assertEquals("OMNIWEB", $this->object->get('PMA_USR_BROWSER_AGENT'), "Browser expected to be OmniWeb");
+
+ $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1)';
+ $this->object->checkClient();
+ $this->assertEquals("Win", $this->object->get('PMA_USR_OS'), "User OS expected to be Windows");
+ $this->assertEquals("IE", $this->object->get('PMA_USR_BROWSER_AGENT'), "Browser expected to be IE");
+
+ $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Unknown; U; Unix BSD/SYSV system; C -) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) Arora/0.10.2';
+ $this->object->checkClient();
+ $this->assertEquals("Unix", $this->object->get('PMA_USR_OS'), "User OS expected to be Unix");
+
+ $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0 (compatible; OS/2 Webexplorer)';
+ $this->object->checkClient();
+ $this->assertEquals("OS/2", $this->object->get('PMA_USR_OS'), "User OS expected to be OS/2");
+
+ $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows; U; Win95; en-US; rv:1.9b) Gecko/20031208';
+ $this->object->checkClient();
+ $this->assertEquals("GECKO", $this->object->get('PMA_USR_BROWSER_AGENT'), "Browser expected to be Gecko");
+
+ $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (compatible; Konqueror/4.5; NetBSD 5.0.2; X11; amd64; en_US) KHTML/4.5.4 (like Gecko)';
+ $this->object->checkClient();
+ $this->assertEquals("KONQUEROR", $this->object->get('PMA_USR_BROWSER_AGENT'), "Browser expected to be Konqueror");
+
+ $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0';
+ $this->object->checkClient();
+ $this->assertEquals("MOZILLA", $this->object->get('PMA_USR_BROWSER_AGENT'), "Browser expected to be Mozilla");
+ $this->assertEquals("Linux", $this->object->get('PMA_USR_OS'), "User OS expected to be Linux");
+
+ }
+
+ public function testCheckGd2()
+ {
+ $prevIsGb2Val = $this->object->get('PMA_IS_GD2');
+
+ $this->object->set('GD2Available','yes');
+ $this->object->checkGd2();
+ $this->assertEquals(1, $this->object->get('PMA_IS_GD2'));
+
+ $this->object->set('GD2Available','no');
+ $this->object->checkGd2();
+ $this->assertEquals(0, $this->object->get('PMA_IS_GD2'));
+
+ $this->object->set('GD2Available',$prevIsGb2Val);
+
+ if (!@function_exists('imagecreatetruecolor'))
+ {
+ $this->object->checkGd2();
+ $this->assertEquals(0, $this->object->get('PMA_IS_GD2'), 'Function imagecreatetruecolor does not exist, PMA_IS_GD2 should be 0');
+ }
+
+ if (@function_exists('gd_info')) {
+ $this->object->checkGd2();
+ $gd_nfo = gd_info();
+ if (strstr($gd_nfo["GD Version"], '2.')) {
+ $this->assertEquals(1, $this->object->get('PMA_IS_GD2'), 'GD Version >= 2, PMA_IS_GD2 should be 1');
+ } else {
+ $this->assertEquals(0, $this->object->get('PMA_IS_GD2'), 'GD Version < 2, PMA_IS_GD2 should be 0');
+ }
+ }
+
+ /* Get GD version string from phpinfo output */
+ ob_start();
+ phpinfo(INFO_MODULES); /* Only modules */
+ $a = strip_tags(ob_get_contents());
+ ob_end_clean();
+
+ if (preg_match('@GD Version[[:space:]]*\(.*\)@', $a, $v)) {
+ if (strstr($v, '2.')) {
+ $this->assertEquals(1, $this->object->get('PMA_IS_GD2'), 'PMA_IS_GD2 should be 1');
+ } else {
+ $this->assertEquals(0, $this->object->get('PMA_IS_GD2'), 'PMA_IS_GD2 should be 0');
+ }
+ }
+ }
+
+ public function testCheckWebServer()
+ {
+ $_SERVER['SERVER_SOFTWARE'] = "Microsoft-IIS 7.0";
+ $this->object->checkWebServer();
+ $this->assertEquals(1, $this->object->get('PMA_IS_IIS'));
+
+ $_SERVER['SERVER_SOFTWARE'] = "Apache/2.2.17";
+ $this->object->checkWebServer();
+ $this->assertEquals(0, $this->object->get('PMA_IS_IIS'));
+
+ unset($_SERVER['SERVER_SOFTWARE']);
+ }
+
+ public function testCheckWebServerOs()
+ {
+ $this->object->checkWebServerOs();
+
+ if (defined('PHP_OS'))
+ {
+ switch (PHP_OS)
+ {
+ case stristr(PHP_OS,'win'):
+ $this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS'), 'PHP_OS equals: ' . PHP_OS . ' PMA_IS_WINDOWS should be 1');
+ break;
+ case stristr(PHP_OS, 'OS/2'):
+ $this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS'), 'PHP_OS is OS/2 PMA_IS_WINDOWS should be 1 (No file permissions like Windows)');
+ break;
+ case stristr(PHP_OS, 'Linux'):
+ $this->assertEquals(0, $this->object->get('PMA_IS_WINDOWS'));
+ break;
+ }
+ }
+ else
+ {
+ $this->assertEquals(0, $this->object->get('PMA_IS_WINDOWS'), 'PMA_IS_WINDOWS Default to Unix or Equiv');
+
+ define('PHP_OS','Windows');
+ $this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS'), 'PMA_IS_WINDOWS must be 1');
+ }
+ }
+
+ public function testCheckPhpVersion()
+ {
+ $this->object->checkPhpVersion();
+
+ $php_int_ver = 0;
+ $php_str_ver = phpversion();
+
+ $match = array();
+ preg_match('@([0-9]{1,2}).([0-9]{1,2}).([0-9]{1,2})@', phpversion(), $match);
+ if (isset($match) && ! empty($match[1])) {
+ if (! isset($match[2])) {
+ $match[2] = 0;
+ }
+ if (! isset($match[3])) {
+ $match[3] = 0;
+ }
+ $php_int_ver = (int) sprintf('%d%02d%02d', $match[1], $match[2], $match[3]);
+ } else {
+ $php_int_ver = 0;
+ }
+
+ $this->assertEquals($php_str_ver, $this->object->get('PMA_PHP_STR_VERSION'));
+ $this->assertEquals($php_int_ver, $this->object->get('PMA_PHP_INT_VERSION'));
+ }
+
+ public function testLoadDefaults()
+ {
+ $prevDefaultSource = $this->object->default_source;
+
+ $this->object->default_source = 'unexisted.file.php';
+ $this->assertFalse($this->object->loadDefaults());
+
+ $this->object->default_source = $prevDefaultSource;
+
+ include $this->object->default_source;
+
+ $loadedConf = $cfg;
+ unset($cfg);
+
+ $this->assertTrue($this->object->loadDefaults());
+
+ $this->assertEquals($this->object->default_source_mtime, filemtime($prevDefaultSource));
+ $this->assertEquals($loadedConf['Servers'][1], $this->object->default_server);
+
+ unset($loadedConf['Servers']);
+
+ $this->assertEquals($loadedConf, $this->object->default);
+
+ $expectedSettings = PMA_array_merge_recursive($this->object->settings, $loadedConf);
+
+ $this->assertEquals($expectedSettings, $this->object->settings,'Settings loaded wrong');
+
+ $this->assertFalse($this->object->error_config_default_file);
+ }
+
+ public function testCheckConfigSource()
+ {
+ $this->object->setSource('unexisted.config.php');
+ $this->assertFalse($this->object->checkConfigSource());
+ $this->assertEquals(0, $this->object->source_mtime);
+
+// if(! is_readable($this->object->getSource()))
+// $this->markTestSkipped('Configuration file is read only');
+
+ $this->object->setSource('libraries/config.default.php');
+
+ $this->assertNotEmpty($this->object->getSource());
+ $this->assertTrue($this->object->checkConfigSource());
+ }
+
+ /**
+ * @covers PMA_Config::get
+ * @covers PMA_Config::set
+ * @return void
+ */
+ public function testGetAndSet()
+ {
+ $this->assertNull($this->object->get("unresisting_setting"));
+
+ $this->object->set('test_setting', 'test_value');
+
+ $this->assertEquals('test_value', $this->object->get('test_setting'));
+ }
+
+ /**
+ * @covers PMA_Config::getSource
+ * @covers PMA_Config::setSource
+ */
+ public function testGetSetSource()
+ {
+ echo $this->object->getSource();
+
+ $this->assertEmpty($this->object->getSource(), "Source is null by default");
+
+ $this->object->setSource("config.sample.inc.php");
+
+ $this->assertEquals("config.sample.inc.php", $this->object->getSource(), "Cant set new source");
+ }
+
+ public function testCheckPmaAbsoluteUriEmpty()
+ {
+ $this->object->set('PmaAbsoluteUri','');
+ $this->assertFalse($this->object->checkPmaAbsoluteUri(), 'PmaAbsoluteUri is not set and should be error');
+ $this->assertTrue($this->object->error_pma_uri, 'PmaAbsoluteUri is not set and should be error');
+ }
+
+ /**
+ * @depends testCheckPmaAbsoluteUriEmpty
+ */
+ public function testCheckPmaAbsoluteUriNormal()
+ {
+ $this->object->set('PmaAbsoluteUri','http://localhost/phpmyadmin/');
+ $this->object->checkPmaAbsoluteUri();
+ $this->assertEquals("http://localhost/phpmyadmin/", $this->object->get('PmaAbsoluteUri'));
+
+ $this->object->set('PmaAbsoluteUri','http://localhost/phpmyadmin');
+ $this->object->checkPmaAbsoluteUri();
+ $this->assertEquals("http://localhost/phpmyadmin/", $this->object->get('PmaAbsoluteUri'), 'Expected trailing slash at the end of the phpMyAdmin uri');
+
+ }
+
+ /**
+ * @depends testCheckPmaAbsoluteUriNormal
+ */
+ public function testCheckPmaAbsoluteUriScheme()
+ {
+ $_SERVER['HTTP_HOST'] = 'localhost';
+ $_SERVER['HTTP_SCHEME'] = 'http';
+ $_SERVER['HTTPS'] = 'off';
+ $GLOBALS['PMA_PHP_SELF'] = 'index.php';
+
+ $this->object->set('PmaAbsoluteUri','');
+
+ $this->object->checkPmaAbsoluteUri();
+ $this->assertEquals("http://localhost/", $this->object->get('PmaAbsoluteUri'));
+ }
+
+ /**
+ * @depends testCheckPmaAbsoluteUriScheme
+ */
+ public function testCheckPmaAbsoluteUriUser()
+ {
+ $this->object->set('PmaAbsoluteUri','http://user:pwd@localhost/phpmyadmin/index.php');
+
+ $this->object->checkPmaAbsoluteUri();
+ $this->assertEquals("http://user:pwd@localhost/phpmyadmin/index.php/", $this->object->get('PmaAbsoluteUri'));
+
+ $this->object->set('PmaAbsoluteUri','https://user:pwd@localhost/phpmyadmin/index.php');
+
+ $this->object->checkPmaAbsoluteUri();
+ $this->assertEquals("https://user:pwd@localhost/phpmyadmin/index.php/", $this->object->get('PmaAbsoluteUri'));
+ }
+
+ public function testCheckCollationConnection()
+ {
+ $_REQUEST['collation_connection'] = 'utf-8';
+ $this->object->checkCollationConnection();
+
+ $this->assertEquals($_REQUEST['collation_connection'], $this->object->get('collation_connection'));
+ }
+
+ public function testIsHttps()
+ {
+ $this->object->set('PmaAbsoluteUri', 'http://some_host.com/phpMyAdmin');
+ $this->assertFalse($this->object->isHttps());
+
+ $this->object->set('PmaAbsoluteUri', 'https://some_host.com/phpMyAdmin');
+ $this->assertFalse($this->object->isHttps());
+ }
+
+ public function testDetectHttps()
+ {
+ unset($_SERVER['REQUEST_URI']);
+ unset($_SERVER['HTTP_SCHEME']);
+ unset($_SERVER['HTTPS']);
+
+ $this->assertFalse($this->object->detectHttps());
+
+ $_SERVER['REQUEST_URI'] = '/url:\this_is_not_url';
+ $this->assertFalse($this->object->detectHttps());
+
+ $_SERVER['REQUEST_URI'] = 'file://localhost/phpmyadmin/index.php';
+ $this->assertFalse($this->object->detectHttps());
+
+ $_ENV['REQUEST_URI'] = 'http://localhost/phpmyadmin/index.php';
+ $this->assertFalse($this->object->detectHttps());
+
+ $_SERVER['REQUEST_URI'] = 'https://localhost/phpmyadmin/index.php';
+ $this->assertTrue($this->object->detectHttps());
+
+ $_SERVER['REQUEST_URI'] = 'localhost/phpmyadmin/index.php';
+ $_SERVER['HTTP_SCHEME'] = 'https';
+ $_SERVER['HTTPS'] = 'on';
+ $this->assertTrue($this->object->detectHttps());
+ }
+
+ /**
+ * @depends testDetectHttps
+ */
+ public function testCheckCookiePath()
+ {
+ $this->object->checkCookiePath();
+ echo $this->object->get('cookie_path');
+ $this->assertEquals('',$this->object->get('cookie_path'));
+ }
+
+ /**
+ * @depends testCheckSystem
+ * @depends testCheckWebServer
+ * @depends testLoadDefaults
+ * @depends testLoad
+ */
+ public function testEnableBc()
+ {
+ $this->object->enableBc();
+
+ $defines = array(
+ 'PMA_VERSION',
+ 'PMA_THEME_VERSION',
+ 'PMA_THEME_GENERATION',
+ 'PMA_PHP_STR_VERSION',
+ 'PMA_PHP_INT_VERSION',
+ 'PMA_IS_WINDOWS',
+ 'PMA_IS_IIS',
+ 'PMA_IS_GD2',
+ 'PMA_USR_OS',
+ 'PMA_USR_BROWSER_VER',
+ 'PMA_USR_BROWSER_AGENT'
+ );
+
+ foreach ($defines as $define)
+ {
+ $this->assertTrue(defined($define));
+ $this->assertEquals(constant($define), $this->object->get($define));
+ }
+ }
+
+ /**
+ * @todo Implement testSave().
+ */
+ public function testSave()
+ {
+ // Remove the following lines when you implement this test.
+ $this->markTestIncomplete(
+ 'This test has not been implemented yet.'
+ );
+ }
+
+ /**
+ * @todo Implement testGetFontsizeForm().
+ */
+ public function testGetFontsizeForm()
+ {
+ // Remove the following lines when you implement this test.
+ $this->markTestIncomplete(
+ 'This test has not been implemented yet.'
+ );
+ }
+
+ /**
+ * @todo Implement testRemoveCookie().
+ */
+ public function testRemoveCookie()
+ {
+ // Remove the following lines when you implement this test.
+ $this->markTestIncomplete(
+ 'This test has not been implemented yet.'
+ );
+ }
+ /**
+ * @todo Implement testCheckFontsize().
+ */
+ public function testCheckFontsize()
+ {
+ // Remove the following lines when you implement this test.
+ $this->markTestIncomplete(
+ 'This test has not been implemented yet.'
+ );
+ }
+
+ /**
+ * @todo Implement testCheckUpload().
+ */
+ public function testCheckUpload()
+ {
+ // Remove the following lines when you implement this test.
+ $this->markTestIncomplete(
+ 'This test has not been implemented yet.'
+ );
+ }
+
+ /**
+ * @todo Implement testCheckUploadSize().
+ */
+ public function testCheckUploadSize()
+ {
+ // Remove the following lines when you implement this test.
+ $this->markTestIncomplete(
+ 'This test has not been implemented yet.'
+ );
+ }
+
+ /**
+ * @todo Implement testCheckIsHttps().
+ */
+ public function testCheckIsHttps()
+ {
+ // Remove the following lines when you implement this test.
+ $this->markTestIncomplete(
+ 'This test has not been implemented yet.'
+ );
+ }
+
+ /**
+ * @todo Implement testGetCookiePath().
+ */
+ public function testGetCookiePath()
+ {
+ // Remove the following lines when you implement this test.
+ $this->markTestIncomplete(
+ 'This test has not been implemented yet.'
+ );
+ }
+
+ /**
+ * @todo finish implementing test + dependencies
+ */
+ public function testLoad()
+ {
+ $this->assertFalse($this->object->load());
+
+ $this->assertTrue($this->object->load('./libraries/config.default.php'));
+ }
+
+ /**
+ * @todo Implement testLoadUserPreferences().
+ */
+ public function testLoadUserPreferences()
+ {
+ $this->assertNull($this->object->loadUserPreferences());
+
+// echo $GLOBALS['cfg']['ServerDefault'];
+ }
+
+ /**
+ * @todo Implement testSetUserValue().
+ */
+ public function testSetUserValue()
+ {
+ $this->object->setUserValue(null, 'lang', $GLOBALS['lang'], 'en');
+ $this->object->setUserValue("TEST_COOKIE_USER_VAL",'','cfg_val_1');
+
+ // Remove the following lines when you implement this test.
+// $this->markTestIncomplete(
+// 'This test has not been implemented yet.'
+// );
+ }
+
+ /**
+ * @todo Implement testGetUserValue().
+ */
+ public function testGetUserValue()
+ {
+ // Remove the following lines when you implement this test.
+ $this->markTestIncomplete(
+ 'This test has not been implemented yet.'
+ );
+ }
+
+ /**
+ * @todo Implement testGetThemeUniqueValue().
+ */
+ public function testGetThemeUniqueValue()
+ {
+ // Remove the following lines when you implement this test.
+ $this->markTestIncomplete(
+ 'This test has not been implemented yet.'
+ );
+ }
+
+ /**
+ * @todo Implement testCheckPermissions().
+ */
+ public function testCheckPermissions()
+ {
+ // Remove the following lines when you implement this test.
+ $this->markTestIncomplete(
+ 'This test has not been implemented yet.'
+ );
+ }
+
+
+ /**
+ * @todo Implement testSetCookie().
+ */
+ public function testSetCookie()
+ {
+ $this->assertFalse($this->object->setCookie('TEST_DEF_COOKIE', 'test_def_123', 'test_def_123'));
+
+ $this->assertTrue($this->object->setCookie('TEST_CONFIG_COOKIE', 'test_val_123', null, 3600));
+
+ $this->assertTrue($this->object->setCookie('TEST_CONFIG_COOKIE', '', 'default_val'));
+
+ $_COOKIE['TEST_MANUAL_COOKIE'] = 'some_test_val';
+ $this->assertTrue($this->object->setCookie('TEST_MANUAL_COOKIE', 'other', 'other'));
+
+ }
+}
+?>
diff --git a/test/classes/PMA_Message_test.php b/test/classes/PMA_Message_test.php
new file mode 100644
index 0000000..405bb75
--- /dev/null
+++ b/test/classes/PMA_Message_test.php
@@ -0,0 +1,432 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_Message class
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/sanitizing.lib.php';
+require_once 'libraries/core.lib.php';
+require_once 'libraries/Message.class.php';
+
+class PMA_Message_test extends PHPUnit_Extensions_OutputTestCase
+{
+ /**
+ * @var PMA_Message
+ * @access protected
+ */
+ protected $object;
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ * @access protected
+ */
+ protected function setUp()
+ {
+ $this->object = new PMA_Message;
+ }
+
+ /**
+ * Tears down the fixture, for example, closes a network connection.
+ * This method is called after a test is executed.
+ *
+ * @access protected
+ */
+ protected function tearDown()
+ {
+ }
+
+ /**
+ * to String casting test
+ */
+ public function test__toString()
+ {
+ $this->object->setMessage('test<&>', true);
+ $this->assertEquals('test<&>', (string)$this->object);
+ }
+
+ /**
+ * test success method
+ */
+ public function testSuccess()
+ {
+ $this->object = new PMA_Message('test<&>', PMA_Message::SUCCESS);
+ $this->assertEquals($this->object, PMA_Message::success('test<&>'));
+ $this->assertEquals('Your SQL query has been executed successfully', PMA_Message::success()->getString());
+ }
+
+ /**
+ * test error method
+ */
+ public function testError()
+ {
+ $this->object = new PMA_Message('test<&>', PMA_Message::ERROR);
+ $this->assertEquals($this->object, PMA_Message::error('test<&>'));
+ $this->assertEquals('Error', PMA_Message::error()->getString());
+ }
+
+ /**
+ * test notice method
+ */
+ public function testNotice()
+ {
+ $this->object = new PMA_Message('test<&>', PMA_Message::NOTICE);
+ $this->assertEquals($this->object, PMA_Message::notice('test<&>'));
+ }
+
+ /**
+ * test rawError method
+ */
+ public function testRawError()
+ {
+ $this->object = new PMA_Message('', PMA_Message::ERROR);
+ $this->object->setMessage('test<&>');
+
+ $this->assertEquals($this->object, PMA_Message::rawError('test<&>'));
+ }
+
+ /**
+ * test rawNotice method
+ */
+ public function testRawNotice()
+ {
+ $this->object = new PMA_Message('', PMA_Message::NOTICE);
+ $this->object->setMessage('test<&>');
+
+ $this->assertEquals($this->object, PMA_Message::rawNotice('test<&>'));
+ }
+
+ /**
+ * test rawSuccess method
+ */
+ public function testRawSuccess()
+ {
+ $this->object = new PMA_Message('', PMA_Message::SUCCESS);
+ $this->object->setMessage('test<&>');
+
+ $this->assertEquals($this->object, PMA_Message::rawSuccess('test<&>'));
+ }
+
+ /**
+ * testing isSuccess method
+ */
+ public function testIsSuccess()
+ {
+ $this->assertFalse($this->object->isSuccess());
+ $this->assertTrue($this->object->isSuccess(true));
+ }
+
+ /**
+ * testing isNotice method
+ */
+ public function testIsNotice()
+ {
+ $this->assertTrue($this->object->isNotice());
+ $this->object->isError(true);
+ $this->assertFalse($this->object->isNotice());
+ $this->assertTrue($this->object->isNotice(true));
+ }
+
+ /**
+ * testing isError method
+ */
+ public function testIsError()
+ {
+ $this->assertFalse($this->object->isError());
+ $this->assertTrue($this->object->isError(true));
+ }
+
+ /**
+ * testign setter of message
+ */
+ public function testSetMessage()
+ {
+ $this->object->setMessage('test&<>', false);
+ $this->assertEquals('test&<>', $this->object->getMessage());
+ $this->object->setMessage('test&<>', true);
+ $this->assertEquals('test&<>', $this->object->getMessage());
+ }
+
+ /**
+ * testing setter of string
+ */
+ public function testSetString()
+ {
+ $this->object->setString('test&<>', false);
+ $this->assertEquals('test&<>', $this->object->getString());
+ $this->object->setString('test&<>', true);
+ $this->assertEquals('test&<>', $this->object->getString());
+ }
+
+ /**
+ * testing add param method
+ */
+ public function testAddParam()
+ {
+ $this->object->addParam(PMA_Message::notice('test'));
+ $this->assertEquals(array(PMA_Message::notice('test')), $this->object->getParams());
+ $this->object->addParam('test', true);
+ $this->assertEquals(array(PMA_Message::notice('test'), 'test'), $this->object->getParams());
+ $this->object->addParam('test', false);
+ $this->assertEquals(array(PMA_Message::notice('test'), 'test', PMA_Message::notice('test')), $this->object->getParams());
+ }
+
+ /**
+ * testing add string method
+ */
+ public function testAddString()
+ {
+ $this->object->addString('test', '*');
+ $this->assertEquals(array('*', PMA_Message::notice('test')), $this->object->getAddedMessages());
+ $this->object->addString('test', '');
+ $this->assertEquals(array('*', PMA_Message::notice('test'), '', PMA_Message::notice('test')), $this->object->getAddedMessages());
+ }
+
+ /**
+ * testing add message method
+ */
+ public function testAddMessage()
+ {
+ $this->object->addMessage('test', '');
+ $this->assertEquals(array(PMA_Message::rawNotice('test')), $this->object->getAddedMessages());
+ $this->object->addMessage('test');
+ $this->assertEquals(array(PMA_Message::rawNotice('test'), ' ', PMA_Message::rawNotice('test')), $this->object->getAddedMessages());
+ }
+
+ /**
+ * testing add messages method
+ */
+ public function testAddMessages()
+ {
+ $messages = array();
+ $messages[] = "Test1";
+ $messages[] = new PMA_Message("PMA_Test2", PMA_Message::ERROR);
+ $messages[] = "Test3";
+ $this->object->addMessages($messages, '');
+
+ $this->assertEquals(array(PMA_Message::rawNotice('Test1'), PMA_Message::error("PMA_Test2"), PMA_Message::rawNotice('Test3')), $this->object->getAddedMessages());
+ }
+
+ /**
+ * testing setter of params
+ */
+ public function testSetParams()
+ {
+ $this->object->setParams('test&<>');
+ $this->assertEquals('test&<>', $this->object->getParams());
+ $this->object->setParams('test&<>', true);
+ $this->assertEquals('test&<>', $this->object->getParams());
+ }
+
+ /**
+ * testing sanitize method
+ */
+ public function testSanitize()
+ {
+ $this->object->setString('test&string<>', false);
+ $this->assertEquals('test&string<>', PMA_Message::sanitize($this->object));
+ $this->assertEquals(array('test&string<>', 'test&string<>'), PMA_Message::sanitize(array($this->object, $this->object)));
+ }
+
+ public function decodeBBDataProvider()
+ {
+ return array(
+ array('[i]test[/i][i]aa[i/][em]test[/em]', '<em>test</em><em>aa[i/]<em>test</em>'),
+ array('[b]test[/b][strong]test[/strong]', '<strong>test</strong><strong>test</strong>'),
+ array('[tt]test[/tt][code]test[/code]', '<code>test</code><code>test</code>'),
+ array('[kbd]test[/kbd][br][sup]test[/sup]', '<kbd>test</kbd><br /><sup>test</sup>')
+ );
+ }
+
+ /**
+ * testing decodeBB method
+ * @dataProvider decodeBBDataProvider
+ */
+
+ public function testDecodeBB($actual, $expected)
+ {
+ $this->assertEquals($expected, PMA_Message::decodeBB($actual));
+ }
+
+ /**
+ * testing format method
+ */
+ public function testFormat()
+ {
+ $this->assertEquals('test string', PMA_Message::format('test string'));
+ $this->assertEquals('test string', PMA_Message::format('test string', 'a'));
+ $this->assertEquals('test string', PMA_Message::format('test string', array()));
+ $this->assertEquals('test string', PMA_Message::format('%s string', array('test')));
+
+ }
+
+ /**
+ * testing getHash method
+ */
+ public function testGetHash()
+ {
+ $this->object->setString('<&>test', false);
+ $this->object->setMessage('<&>test', false);
+ $this->assertEquals(md5(PMA_Message::NOTICE . '<&>test<&>test'), $this->object->getHash());
+ }
+
+ /**
+ * getMessage test - with empty message and with non-empty string - not key in globals
+ * additional params are defined
+ */
+ public function testGetMessageWithoutMessageWithStringWithParams()
+ {
+ $this->object->setMessage('');
+ $this->object->setString('test string %s %s');
+ $this->object->addParam('test param 1');
+ $this->object->addParam('test param 2');
+ $this->assertEquals('test string test param 1 test param 2', $this->object->getMessage());
+ }
+
+ /**
+ * getMessage test - with empty message and with empty string
+ */
+ public function testGetMessageWithoutMessageWithEmptyString()
+ {
+ $this->object->setMessage('');
+ $this->object->setString('');
+ $this->assertEquals('', $this->object->getMessage());
+ }
+
+ /**
+ * getMessage test - with empty message and with string, which is key to GLOBALS
+ * additional messages are defined
+ */
+ public function testGetMessageWithoutMessageWithGlobalStringWithAddMessages()
+ {
+ $GLOBALS['key'] = 'test message';
+ $this->object->setMessage('');
+ $this->object->setString('key');
+ $this->object->addMessage('test message 2', ' - ');
+ $this->object->addMessage('test message 3', '&');
+ $this->assertEquals('test message - test message 2&test message 3', $this->object->getMessage());
+ unset($GLOBALS['key']);
+ }
+
+ /**
+ * getMessage test - message is defined
+ * message with BBCode defined
+ */
+ public function testGetMessageWithMessageWithBBCode()
+ {
+ $this->object->setMessage('[kbd]test[/kbd] [a@./Documentation.html#cfg_Example@_blank]test[/a]');
+ $this->assertEquals('<kbd>test</kbd> <a href="./Documentation.html#cfg_Example" target="_blank">test</a>', $this->object->getMessage());
+ }
+
+ /**
+ * getLevel test
+ */
+ public function testGetLevel()
+ {
+ $this->assertEquals('notice', $this->object->getLevel());
+ $this->object->setNumber(PMA_Message::SUCCESS);
+ $this->assertEquals('success', $this->object->getLevel());
+ $this->object->setNumber(PMA_Message::ERROR);
+ $this->assertEquals('error', $this->object->getLevel());
+ }
+
+ /**
+ * testing display method (output string and _is_displayed varible)
+ */
+ public function testDisplay()
+ {
+ $this->assertFalse($this->object->isDisplayed());
+ $this->object->setMessage('Test Message');
+
+ $this->expectOutputString('<div class="notice">Test Message</div>');
+ $this->object->display();
+
+ $this->assertTrue($this->object->isDisplayed());
+ }
+
+ /**
+ * getDisplay test
+ */
+ public function testGetDisplay()
+ {
+ $this->object->setMessage('Test Message');
+ $this->assertEquals('<div class="notice">Test Message</div>', $this->object->getDisplay());
+ }
+
+ /**
+ * isDisplayed test
+ */
+ public function testIsDisplayed()
+ {
+ $this->assertFalse($this->object->isDisplayed(false));
+ $this->assertTrue($this->object->isDisplayed(true));
+ $this->assertTrue($this->object->isDisplayed(false));
+ }
+
+ public function providerAffectedRows(){
+ return array(array(1, '<div class="notice"> 1 row affected.</div>'));
+ return array(array(2, '<div class="notice"> 2 rows affected.</div>'));
+ return array(array(50000000000000, '<div class="notice"> 50000000000000 rows affected.</div>'));
+ }
+
+ /**
+ * affected_rows test
+ *
+ * @dataProvider providerAffectedRows
+ */
+ public function testAffectedRows($rows, $output)
+ {
+ $this->object = new PMA_Message();
+ $msg = $this->object->affected_rows($rows);
+ echo $this->object->addMessage($msg);
+ $this->expectOutputString($output);
+ $this->object->display();
+ }
+
+ public function providerInsertedRows(){
+ return array(array(1, '<div class="notice"> 1 row inserted.</div>'));
+ return array(array(2, '<div class="notice"> 2 rows inserted.</div>'));
+ return array(array(50000000000000, '<div class="notice"> 50000000000000 rows inserted.</div>'));
+ }
+
+ /**
+ * inserted_rows test
+ *
+ * @dataProvider providerInsertedRows
+ */
+ public function testInsertedRows($rows, $output)
+ {
+ $this->object = new PMA_Message();
+ $msg = $this->object->inserted_rows($rows);
+ echo $this->object->addMessage($msg);
+ $this->expectOutputString($output);
+ $this->object->display();
+ }
+
+ public function providerDeletedRows(){
+ return array(array(1, '<div class="notice"> 1 row deleted.</div>'));
+ return array(array(2, '<div class="notice"> 2 rows deleted.</div>'));
+ return array(array(50000000000000, '<div class="notice"> 50000000000000 rows deleted.</div>'));
+ }
+
+ /**
+ * deleted_rows test
+ *
+ * @dataProvider providerDeletedRows
+ */
+ public function testDeletedRows($rows, $output)
+ {
+ $this->object = new PMA_Message();
+ $msg = $this->object->deleted_rows($rows);
+ echo $this->object->addMessage($msg);
+ $this->expectOutputString($output);
+ $this->object->display();
+ }
+}
+?>
diff --git a/test/classes/PMA_Theme_test.php b/test/classes/PMA_Theme_test.php
new file mode 100644
index 0000000..d8ca699
--- /dev/null
+++ b/test/classes/PMA_Theme_test.php
@@ -0,0 +1,206 @@
+<?php
+
+require_once 'libraries/Theme.class.php';
+
+/**
+ * Test class for PMA_Theme.
+ * Generated by PHPUnit on 2011-07-18 at 03:19:13.
+ */
+class PMA_ThemeTest extends PHPUnit_Extensions_OutputTestCase
+{
+ /**
+ * @var PMA_Theme
+ */
+ protected $object;
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ */
+ protected function setUp()
+ {
+ $this->object = new PMA_Theme;
+ }
+
+ /**
+ * Tears down the fixture, for example, closes a network connection.
+ * This method is called after a test is executed.
+ */
+ protected function tearDown()
+ {
+ }
+
+ public function testCheckImgPathNotExisted()
+ {
+ $this->object->setPath('path/to/nowhere');
+ $this->assertFalse($this->object->loadInfo());
+ }
+
+ public function testCheckImgPathIncorrect()
+ {
+ $this->object->setPath('./test/classes/_data/incorrect_theme');
+ $this->assertFalse($this->object->loadInfo(), 'Theme name is not properly set');
+ }
+
+ public function testCheckImgPathFull()
+ {
+ $this->object->setPath('./test/classes/_data/gen_version_info');
+ $this->assertTrue($this->object->loadInfo());
+ $this->assertEquals('Test Theme', $this->object->getName());
+ $this->assertEquals('2.0.3', $this->object->getVersion());
+ }
+
+ public function testLoadInfo()
+ {
+ $this->object->setPath('./themes/original');
+ $this->assertTrue($this->object->loadInfo());
+
+ $this->assertEquals(filemtime($this->object->getPath().'/info.inc.php'), $this->object->mtime_info);
+
+ $this->object->setPath('./themes/original');
+ $this->object->mtime_info = filemtime($this->object->getPath().'/info.inc.php');
+ $this->assertTrue($this->object->loadInfo());
+ $this->assertEquals('Original', $this->object->getName());
+ }
+
+ public function testLoad()
+ {
+ $newTheme = PMA_Theme::load('./themes/original');
+ $this->assertNotNull($newTheme);
+ }
+
+ public function testLoadNotExisted()
+ {
+ $this->assertFalse(PMA_Theme::load('/path/to/nowhere'));
+ }
+
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ */
+ public function testCheckImgPathBad()
+ {
+ $prevConfPath = $GLOBALS['cfg']['ThemePath'];
+ $GLOBALS['cfg']['ThemePath'] = 'nowhere';
+ $this->object->setPath('path/to/nowhere');
+
+ $this->object->checkImgPath();
+ }
+
+ public function testCheckImgPath()
+ {
+ $this->object->setPath('./themes/original');
+ $this->assertTrue($this->object->checkImgPath());
+ }
+
+ public function testCheckImgPathGlobals()
+ {
+ $this->object->setPath('/this/is/wrong/path');
+ $GLOBALS['cfg']['ThemePath'] = 'themes';
+ $this->assertTrue($this->object->checkImgPath());
+ }
+
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ */
+ public function testCheckImgPathGlobalsWrongPath()
+ {
+ $prevThemePath = $GLOBALS['cfg']['ThemePath'];
+ $GLOBALS['cfg']['ThemePath'] = 'no_themes';
+
+ $this->object->setPath('/this/is/wrong/path');
+ $this->object->checkImgPath();
+
+ $GLOBALS['cfg']['ThemePath'] = $prevThemePath;
+ }
+
+ /**
+ * @covers PMA_Theme::setPath
+ * @covers PMA_Theme::getPath
+ */
+ public function testGetSetPath()
+ {
+ $this->assertEmpty($this->object->getPath());
+ $this->object->setPath('./themes/original');
+
+ $this->assertEquals('./themes/original', $this->object->getPath());
+ }
+
+ public function testGetLayoutFile()
+ {
+ $this->assertContains('layout.inc.php', $this->object->getLayoutFile());
+ }
+
+ /**
+ * @depends testLoadInfo
+ */
+ public function testGetSetCheckVersion()
+ {
+ $this->assertEquals('0.0.0.0', $this->object->getVersion(), 'Version 0.0.0.0 by default');
+
+ $this->object->setVersion("1.2.3.4");
+ $this->assertEquals('1.2.3.4', $this->object->getVersion());
+
+ $this->assertFalse($this->object->checkVersion("0.0.1.1"));
+ $this->assertTrue($this->object->checkVersion("2.0.1.1"));
+ }
+
+ /**
+ * @covers PMA_Theme::getName
+ * @covers PMA_Theme::setName
+ */
+ public function testGetSetName()
+ {
+ $this->assertEmpty($this->object->getName(), 'Name is empty by default');
+ $this->object->setName('New Theme Name');
+
+ $this->assertEquals('New Theme Name', $this->object->getName());
+ }
+
+ /**
+ * @covers PMA_Theme::getId
+ * @covers PMA_Theme::setId
+ */
+ public function testGetSetId()
+ {
+ $this->assertEmpty($this->object->getId(), 'ID is empty by default');
+ $this->object->setId('NewID');
+
+ $this->assertEquals('NewID', $this->object->getId());
+ }
+
+ /**
+ * @covers PMA_Theme::getImgPath
+ * @covers PMA_Theme::setImgPath
+ */
+ public function testGetSetImgPath()
+ {
+ $this->assertEmpty($this->object->getImgPath(), 'ImgPath is empty by default');
+ $this->object->setImgPath('/new/path');
+
+ $this->assertEquals('/new/path', $this->object->getImgPath());
+ }
+
+ public function testLoadCssWrongType()
+ {
+ $type = 'middle';
+ $this->assertFalse($this->object->loadCss($type));
+ }
+
+ public function testLoadCssNotExisted()
+ {
+ $type = 'print';
+ $this->assertFalse($this->object->loadCss($type));
+ }
+
+ /**
+ * @todo Implement testPrintPreview().
+ */
+ public function testPrintPreview()
+ {
+ // Remove the following lines when you implement this test.
+ $this->markTestIncomplete(
+ 'This test has not been implemented yet.'
+ );
+ }
+}
+?>
diff --git a/test/classes/_data/gen_version_info/info.inc.php b/test/classes/_data/gen_version_info/info.inc.php
new file mode 100644
index 0000000..d4e2e90
--- /dev/null
+++ b/test/classes/_data/gen_version_info/info.inc.php
@@ -0,0 +1,7 @@
+<?php
+/**
+ * Full infrmation about theme, including $theme_generation and $theme_version
+ */
+$theme_name = 'Test Theme';
+$theme_generation = "2";
+$theme_version = "0.3";
\ No newline at end of file
diff --git a/test/classes/_data/incorrect_theme/info.inc.php b/test/classes/_data/incorrect_theme/info.inc.php
new file mode 100644
index 0000000..af6d242
--- /dev/null
+++ b/test/classes/_data/incorrect_theme/info.inc.php
@@ -0,0 +1,7 @@
+<?php
+/**
+ * Incorrect theme information file.
+ * Full name is not specified
+ */
+
+$theme_full_version = '1.0';
\ No newline at end of file
diff --git a/test/libraries/PMA_SQL_parser_data_test.php b/test/libraries/PMA_SQL_parser_data_test.php
new file mode 100644
index 0000000..8c7bc04
--- /dev/null
+++ b/test/libraries/PMA_SQL_parser_data_test.php
@@ -0,0 +1,55 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * tests for correctness of SQL parser data
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/sqlparser.data.php';
+
+class PMA_SQL_parser_data_test extends PHPUnit_Framework_TestCase
+{
+ private function assertSorted($array)
+ {
+ $copy = $array;
+ sort($copy);
+ $difference = array_diff_assoc($array, $copy);
+ $this->assertEquals($difference, array());
+ }
+
+ private function assertParserData($name)
+ {
+ $this->assertSorted($GLOBALS[$name]);
+ }
+
+ public function testPMA_SQPdata_function_name()
+ {
+ $this->assertParserData('PMA_SQPdata_function_name');
+ }
+
+ public function testPMA_SQPdata_column_attrib()
+ {
+ $this->assertParserData('PMA_SQPdata_column_attrib');
+ }
+
+ public function testPMA_SQPdata_reserved_word()
+ {
+ $this->assertParserData('PMA_SQPdata_reserved_word');
+ }
+
+ public function testPMA_SQPdata_forbidden_word()
+ {
+ $this->assertParserData('PMA_SQPdata_forbidden_word');
+ }
+
+ public function testPMA_SQPdata_column_type()
+ {
+ $this->assertParserData('PMA_SQPdata_column_type');
+ }
+
+}
+?>
diff --git a/test/libraries/PMA_SQL_parser_test.php b/test/libraries/PMA_SQL_parser_test.php
new file mode 100644
index 0000000..155f439
--- /dev/null
+++ b/test/libraries/PMA_SQL_parser_test.php
@@ -0,0 +1,246 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Tests for correctness of SQL parser
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/sqlparser.lib.php';
+
+class PMA_SQL_parser_test extends PHPUnit_Framework_TestCase
+{
+ private function assertParser($sql, $expected, $error = '')
+ {
+ $parsed_sql = PMA_SQP_parse($sql);
+ $this->assertEquals(PMA_SQP_getErrorString(), $error);
+ $this->assertEquals($parsed_sql, $expected);
+ }
+
+ public function testParse_1()
+ {
+ $this->assertParser('SELECT 1;', array (
+ 'raw' => 'SELECT 1;',
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'digit_integer',
+ 'data' => '1',
+ 'pos' => 8,
+ ),
+ 2 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 3,
+ ));
+ }
+
+ public function testParse_2()
+ {
+ $this->assertParser('SELECT * from aaa;', array (
+ 'raw' => 'SELECT * from aaa;',
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'from',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'aaa',
+ 'pos' => 17,
+ 'forbidden' => false,
+ ),
+ 4 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 5,
+ ));
+ }
+
+ public function testParse_3()
+ {
+ $this->assertParser('SELECT * from `aaa`;', array (
+ 'raw' => 'SELECT * from `aaa`;',
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'from',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`aaa`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 5,
+ ));
+ }
+
+ public function testParse_4()
+ {
+ $GLOBALS['is_ajax_request'] = true;
+ $this->assertParser('SELECT * from `aaa;', array (
+ 'raw' => 'SELECT * from `aaa`;',
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'from',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`aaa`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 5,
+ ));
+ }
+
+ public function testParse_5()
+ {
+ $this->assertParser('SELECT * FROM `a_table` tbla INNER JOIN b_table` tblb ON tblb.id = tbla.id WHERE tblb.field1 != tbla.field1`;', array (
+ 'raw' => 'SELECT * FROM `a_table` tbla INNER JOIN b_table` tblb ON tblb.id = tbla.id WHERE tblb.field1 != tbla.field1`;',
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'FROM',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`a_table`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'tbla',
+ 'pos' => 28,
+ 'forbidden' => false,
+ ),
+ 5 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'INNER',
+ 'pos' => 34,
+ 'forbidden' => true,
+ ),
+ 6 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'JOIN',
+ 'pos' => 39,
+ 'forbidden' => true,
+ ),
+ 7 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'b_table',
+ 'pos' => 47,
+ 'forbidden' => false,
+ ),
+ 8 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '` tblb ON tblb.id = tbla.id WHERE tblb.field1 != tbla.field1`',
+ 'pos' => 0,
+ ),
+ 9 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 10,
+ ));
+ }
+}
+?>
diff --git a/test/libraries/PMA_STR_sub_test.php b/test/libraries/PMA_STR_sub_test.php
new file mode 100644
index 0000000..e10ff39
--- /dev/null
+++ b/test/libraries/PMA_STR_sub_test.php
@@ -0,0 +1,41 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * tests for PMA_pow()
+ *
+ * @package phpMyAdmin-test
+ */
+
+$match = array();
+preg_match('@^([0-9]{1,2})(?:.([0-9]{1,2})(?:.([0-9]{1,2}))?)?@',
+ phpversion(), $match);
+if (isset($match) && ! empty($match[1])) {
+ if (! isset($match[2])) {
+ $match[2] = 0;
+ }
+ if (! isset($match[3])) {
+ $match[3] = 0;
+ }
+ /**
+ * @ignore
+ */
+ define('PMA_PHP_INT_VERSION',
+ (int) sprintf('%d%02d%02d', $match[1], $match[2], $match[3]));
+} else {
+ /**
+ * @ignore
+ */
+ define('PMA_PHP_INT_VERSION', 0);
+}
+
+require_once 'libraries/string.lib.php';
+
+class PMA_STR_sub_test extends PHPUnit_Framework_TestCase
+{
+ public function testMultiByte()
+ {
+ $this->assertEquals('čšě',
+ PMA_substr('čšěčščěš', 0, 3));
+ }
+}
+?>
diff --git a/test/libraries/PMA_blowfish_test.php b/test/libraries/PMA_blowfish_test.php
new file mode 100644
index 0000000..d860bd0
--- /dev/null
+++ b/test/libraries/PMA_blowfish_test.php
@@ -0,0 +1,51 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for blowfish encryption.
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/blowfish.php';
+
+class PMA_blowfish_test extends PHPUnit_Framework_TestCase
+{
+ public function testEncryptDecryptNumbers()
+ {
+ $secret = '$%ÄüfuDFRR';
+ $string = '12345678';
+ $this->assertEquals($string,
+ PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret));
+ }
+
+ public function testEncryptDecryptChars()
+ {
+ $secret = '$%ÄüfuDFRR';
+ $string = 'abcDEF012!"§$%&/()=?`´"\',.;:-_#+*~öäüÖÄÜ^°²³';
+ $this->assertEquals($string,
+ PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret));
+ }
+
+ /* Due to differences in the initialization factor, these tests are not portable between systems.
+ public function testEncrypt()
+ {
+ $secret = '$%ÄüfuDFRR';
+ $decrypted = '12345678';
+ $encrypted = 'kO/kc4j/nyk=';
+ $this->assertEquals($encrypted, PMA_blowfish_encrypt($decrypted, $secret));
+ }
+
+ public function testDecrypt()
+ {
+ $secret = '$%ÄüfuDFRR';
+ $encrypted = 'kO/kc4j/nyk=';
+ $decrypted = '12345678';
+ $this->assertEquals($decrypted, PMA_blowfish_decrypt($encrypted, $secret));
+ }
+ */
+
+}
+?>
diff --git a/test/libraries/PMA_escapeJsString_test.php b/test/libraries/PMA_escapeJsString_test.php
new file mode 100644
index 0000000..93afaef
--- /dev/null
+++ b/test/libraries/PMA_escapeJsString_test.php
@@ -0,0 +1,36 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for javascript escaping.
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/js_escape.lib.php';
+
+class PMA_escapeJsString_test extends PHPUnit_Framework_TestCase
+{
+ /**
+ * PMA_escapeJsString tests
+ * @dataProvider escapeDataProvider
+ */
+ public function testEscape($target, $source)
+ {
+ $this->assertEquals($target, PMA_escapeJsString($source));
+ }
+
+ public function escapeDataProvider() {
+ return array(
+ array('\\\';', '\';'),
+ array('\r\n\\\'<scrIpt></\' + \'script>', "\r\n'<scrIpt></sCRIPT>"),
+ array('\\\';[XSS]', '\';[XSS]'),
+ array('</\' + \'script></head><body>[HTML]', '</SCRIPT></head><body>[HTML]'),
+ array('\"\\\'\\\\\\\'\"', '"\'\\\'"'),
+ array("\\\\\'\'\'\'\'\'\'\'\'\'\'\'\\\\", "\\''''''''''''\\")
+ );
+ }
+}
+?>
diff --git a/test/libraries/PMA_generateCommonUrl_test.php b/test/libraries/PMA_generateCommonUrl_test.php
new file mode 100644
index 0000000..cc2aacf
--- /dev/null
+++ b/test/libraries/PMA_generateCommonUrl_test.php
@@ -0,0 +1,142 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * tests for PMA_generate_common_url()
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/core.lib.php';
+require_once 'libraries/url_generating.lib.php';
+
+class PMA_generate_common_url_test extends PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ unset($_COOKIE['pma_lang'], $_COOKIE['pma_collation_connection']);
+ }
+
+ public function testOldStyle()
+ {
+ $GLOBALS['server'] = 'x';
+ $GLOBALS['lang'] = 'x';
+ $GLOBALS['collation_connection'] = 'x';
+ $_SESSION[' PMA_token '] = 'x';
+ $GLOBALS['cfg']['ServerDefault'] = 'y';
+
+ $separator = PMA_get_arg_separator();
+ $expected = 'server=x' . htmlentities($separator)
+ . 'lang=x' . htmlentities($separator)
+ . 'collation_connection=x' . htmlentities($separator)
+ . 'token=x'
+ ;
+
+ $expected = 'db=db'
+ . htmlentities($separator) . 'table=table'
+ . htmlentities($separator) . $expected;
+
+ $this->assertEquals($expected, PMA_generate_common_url('db', 'table'));
+ }
+
+ public function testOldStyleDbOnly()
+ {
+ $GLOBALS['server'] = 'x';
+ $GLOBALS['lang'] = 'x';
+ $GLOBALS['collation_connection'] = 'x';
+ $_SESSION[' PMA_token '] = 'x';
+ $GLOBALS['cfg']['ServerDefault'] = 'y';
+
+ $separator = PMA_get_arg_separator();
+ $expected = 'server=x' . htmlentities($separator)
+ . 'lang=x' . htmlentities($separator)
+ . 'collation_connection=x' . htmlentities($separator)
+ . 'token=x'
+ ;
+
+ $expected = 'db=db'
+ . htmlentities($separator) . $expected;
+
+ $this->assertEquals($expected, PMA_generate_common_url('db'));
+ }
+
+ public function testNewStyle()
+ {
+ $GLOBALS['server'] = 'x';
+ $GLOBALS['lang'] = 'x';
+ $GLOBALS['collation_connection'] = 'x';
+ $_SESSION[' PMA_token '] = 'x';
+ $GLOBALS['cfg']['ServerDefault'] = 'y';
+
+ $separator = PMA_get_arg_separator();
+ $expected = 'server=x' . htmlentities($separator)
+ . 'lang=x' . htmlentities($separator)
+ . 'collation_connection=x' . htmlentities($separator)
+ . 'token=x'
+ ;
+
+ $expected = '?db=db'
+ . htmlentities($separator) . 'table=table'
+ . htmlentities($separator) . $expected;
+ $params = array('db' => 'db', 'table' => 'table');
+ $this->assertEquals($expected, PMA_generate_common_url($params));
+ }
+
+ public function testOldStyleWithAlternateSeparator()
+ {
+ $GLOBALS['server'] = 'x';
+ $GLOBALS['lang'] = 'x';
+ $GLOBALS['collation_connection'] = 'x';
+ $_SESSION[' PMA_token '] = 'x';
+ $GLOBALS['cfg']['ServerDefault'] = 'y';
+
+ $separator = PMA_get_arg_separator();
+ $expected = 'server=x' . $separator
+ . 'lang=x' . $separator
+ . 'collation_connection=x' . $separator
+ . 'token=x'
+ ;
+
+ $expected = 'db=db' . $separator . 'table=table' . $separator . $expected;
+ $this->assertEquals($expected, PMA_generate_common_url('db', 'table', '&'));
+ }
+
+ public function testOldStyleWithAlternateSeparatorDbOnly()
+ {
+ $GLOBALS['server'] = 'x';
+ $GLOBALS['lang'] = 'x';
+ $GLOBALS['collation_connection'] = 'x';
+ $_SESSION[' PMA_token '] = 'x';
+ $GLOBALS['cfg']['ServerDefault'] = 'y';
+
+ $separator = PMA_get_arg_separator();
+ $expected = 'server=x' . $separator
+ . 'lang=x' . $separator
+ . 'collation_connection=x' . $separator
+ . 'token=x'
+ ;
+
+ $expected = 'db=db' . $separator . $expected;
+ $this->assertEquals($expected, PMA_generate_common_url('db', '', '&'));
+ }
+
+ public function testDefault()
+ {
+ $GLOBALS['server'] = 'x';
+ $GLOBALS['lang'] = 'x';
+ $GLOBALS['collation_connection'] = 'x';
+ $_SESSION[' PMA_token '] = 'x';
+ $GLOBALS['cfg']['ServerDefault'] = 'y';
+
+ $separator = PMA_get_arg_separator();
+ $expected = 'server=x' . htmlentities($separator)
+ . 'lang=x' . htmlentities($separator)
+ . 'collation_connection=x' . htmlentities($separator)
+ . 'token=x'
+ ;
+ $this->assertEquals($expected, PMA_generate_common_url());
+ }
+}
+?>
diff --git a/test/libraries/PMA_sanitize_test.php b/test/libraries/PMA_sanitize_test.php
new file mode 100644
index 0000000..0e7704c
--- /dev/null
+++ b/test/libraries/PMA_sanitize_test.php
@@ -0,0 +1,43 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * tests for PMA_sanitize()
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test
+ */
+require_once 'libraries/sanitizing.lib.php';
+require_once 'libraries/core.lib.php';
+
+class PMA_sanitize_test extends PHPUnit_Framework_TestCase
+{
+ public function testXssInHref()
+ {
+ $this->assertEquals('[a@javascript:alert(\'XSS\');@target]link</a>',
+ PMA_sanitize('[a@javascript:alert(\'XSS\');@target]link[/a]'));
+ }
+
+/*
+ public function testLink()
+ {
+ $this->assertEquals('<a href="http://www.phpmyadmin.net/" target="target">link</a>',
+ PMA_sanitize('[a@http://www.phpmyadmin.net/@target]link[/a]'));
+ }
+*/
+
+ public function testHtmlTags()
+ {
+ $this->assertEquals('<div onclick="">',
+ PMA_sanitize('<div onclick="">'));
+ }
+
+ public function testBbcoe()
+ {
+ $this->assertEquals('<strong>strong</strong>',
+ PMA_sanitize('[b]strong[/b]'));
+ }
+}
+?>
diff --git a/test/libraries/PMA_transformation_getOptions_test.php b/test/libraries/PMA_transformation_getOptions_test.php
new file mode 100644
index 0000000..99d0a10
--- /dev/null
+++ b/test/libraries/PMA_transformation_getOptions_test.php
@@ -0,0 +1,46 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * tests for PMA_sanitize()
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/transformations.lib.php';
+
+class PMA_transformation_getOptions_test extends PHPUnit_Framework_TestCase
+{
+ public function testDefault()
+ {
+ $this->assertEquals(array('option1 ', ' option2 '),
+ PMA_transformation_getOptions("option1 , option2 "));
+ }
+
+ public function testQuoted()
+ {
+ $this->assertEquals(array('option1', ' option2'),
+ PMA_transformation_getOptions("'option1' ,' option2' "));
+ }
+
+ public function testComma()
+ {
+ $this->assertEquals(array('2,3', ' ,, option ,,'),
+ PMA_transformation_getOptions("'2,3' ,' ,, option ,,' "));
+ }
+
+ public function testEmptyOptions()
+ {
+ $this->assertEquals(array('', '', ''),
+ PMA_transformation_getOptions("'',,"));
+ }
+
+ public function testEmpty()
+ {
+ $this->assertEquals(array(),
+ PMA_transformation_getOptions(''));
+ }
+}
+?>
diff --git a/test/libraries/common/PMA_ajaxResponse_test.php b/test/libraries/common/PMA_ajaxResponse_test.php
new file mode 100644
index 0000000..7f8d69d
--- /dev/null
+++ b/test/libraries/common/PMA_ajaxResponse_test.php
@@ -0,0 +1,72 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_ajaxResponse from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_ajaxResponse_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+require_once 'libraries/Message.class.php';
+
+class PMA_ajaxResponse_test extends PHPUnit_Extensions_OutputTestCase
+{
+ function testAjaxResponseText()
+ {
+ $message = 'text';
+
+ $this->expectOutputString('{"success":true,"message":"' . $message . '"}');
+ PMA_ajaxResponse($message);
+ }
+
+ function testAjaxResponseTextWithExtra()
+ {
+ $message = 'text';
+ $exra = array('str_val' => 'te\x/t"1', 'int_val' => 10);
+
+ $this->expectOutputString('{"success":true,"message":"' . $message . '","str_val":"te\\\\x\/t\"1","int_val":10}');
+ PMA_ajaxResponse($message, true, $exra);
+ }
+
+ function testAjaxResponseTextError()
+ {
+ $message = 'error_text';
+
+ $this->expectOutputString('{"success":false,"error":"' . $message . '"}');
+ PMA_ajaxResponse($message, false);
+ }
+
+ function testAjaxResponseMessage()
+ {
+ $message = new PMA_Message("Message Text", 1);
+
+ $this->expectOutputString('{"success":true,"message":"<div class=\"success\">Message Text<\/div>"}');
+ PMA_ajaxResponse($message);
+ }
+
+ function testAjaxResponseMessageWithExtra()
+ {
+
+ $message = new PMA_Message("Message Text", 1);
+ $exra = array('str_val' => 'te\x/t"1', 'int_val' => 10);
+
+ $this->expectOutputString('{"success":true,"message":"<div class=\"success\">Message Text<\/div>","str_val":"te\\\\x\/t\"1","int_val":10}');
+ PMA_ajaxResponse($message, true, $exra);
+ }
+
+ function testAjaxResponseMessageError()
+ {
+
+ $message = new PMA_Message("Error Message Text", 1);
+
+ // TODO: class for output div should be "error"
+ $this->expectOutputString('{"success":false,"error":"<div class=\"success\">Error Message Text<\/div>"}');
+ PMA_ajaxResponse($message, false);
+ }
+
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_browseUploadFile_test.php b/test/libraries/common/PMA_browseUploadFile_test.php
new file mode 100644
index 0000000..45b8407
--- /dev/null
+++ b/test/libraries/common/PMA_browseUploadFile_test.php
@@ -0,0 +1,48 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_browseUploadFile from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_browseUploadFile_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_browseUploadFile_test extends PHPUnit_Extensions_OutputTestCase{
+
+ /*
+ * Data provider for test
+ */
+ public function dataProvider() {
+ return array(
+ array(10, __('B'), "10"),
+ array(100, __('B'), "100"),
+ array(1024, __('B'), "1,024"),
+ array(102400, __('KiB'), "100"),
+ array(10240000, __('MiB'), "10"),
+ array(2147483648, __('MiB'), "2,048"),
+ array(21474836480, __('GiB'), "20")
+ );
+ }
+
+ /**
+ * @dataProvider dataProvider
+ * @return void
+ */
+ function testBrowseUploadFile($size, $unit, $res){
+
+ $this->expectOutputString('<label for="radio_import_file">' . __("Browse your computer:") . '</label>'
+ . '<div id="upload_form_status" style="display: none;"></div>'
+ . '<div id="upload_form_status_info" style="display: none;"></div>'
+ . '<input type="file" name="import_file" id="input_import_file" />'
+ . "(" . __('Max: '). $res . $unit .")" . "\n"
+ . '<input type="hidden" name="MAX_FILE_SIZE" value="' .$size . '" />' . "\n");
+
+ PMA_browseUploadFile($size);
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_buildActionTitles_test.php b/test/libraries/common/PMA_buildActionTitles_test.php
new file mode 100644
index 0000000..130a972
--- /dev/null
+++ b/test/libraries/common/PMA_buildActionTitles_test.php
@@ -0,0 +1,42 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_buildActionTitles from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_buildActionTitles_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_buildActionTitles_test extends PHPUnit_Framework_TestCase{
+
+ function testBuildActionTitles(){
+ $titles = array();
+
+ $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse'), true);
+ $titles['NoBrowse'] = PMA_getIcon('bd_browse.png', __('Browse'), true);
+ $titles['Search'] = PMA_getIcon('b_select.png', __('Search'), true);
+ $titles['NoSearch'] = PMA_getIcon('bd_select.png', __('Search'), true);
+ $titles['Insert'] = PMA_getIcon('b_insrow.png', __('Insert'), true);
+ $titles['NoInsert'] = PMA_getIcon('bd_insrow.png', __('Insert'), true);
+ $titles['Structure'] = PMA_getIcon('b_props.png', __('Structure'), true);
+ $titles['Drop'] = PMA_getIcon('b_drop.png', __('Drop'), true);
+ $titles['NoDrop'] = PMA_getIcon('bd_drop.png', __('Drop'), true);
+ $titles['Empty'] = PMA_getIcon('b_empty.png', __('Empty'), true);
+ $titles['NoEmpty'] = PMA_getIcon('bd_empty.png', __('Empty'), true);
+ $titles['Edit'] = PMA_getIcon('b_edit.png', __('Edit'), true);
+ $titles['NoEdit'] = PMA_getIcon('bd_edit.png', __('Edit'), true);
+ $titles['Export'] = PMA_getIcon('b_export.png', __('Export'), true);
+ $titles['NoExport'] = PMA_getIcon('bd_export.png', __('Export'), true);
+ $titles['Execute'] = PMA_getIcon('b_nextpage.png', __('Execute'), true);
+ $titles['NoExecute'] = PMA_getIcon('bd_nextpage.png', __('Execute'), true);
+
+ $this->assertEquals($titles, PMA_buildActionTitles());
+
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_cache_test.php b/test/libraries/common/PMA_cache_test.php
new file mode 100644
index 0000000..2284078
--- /dev/null
+++ b/test/libraries/common/PMA_cache_test.php
@@ -0,0 +1,108 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for caching data in session
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_cache_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_cache_test extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ * @var array temporary variable for globals array
+ */
+ protected $tmpGlobals;
+
+ /**
+ * @var array temporary variable for session array
+ */
+ protected $tmpSession;
+
+ /**
+ * storing globals and session
+ */
+ public function setUp()
+ {
+ $this->tmpGlobals = $GLOBALS;
+ $this->tmpSession = $_SESSION;
+ }
+
+ /**
+ * Test if cached data is available after set
+ */
+ public function testCacheExists()
+ {
+ $GLOBALS['server'] = 'server';
+ PMA_cacheSet('test_data', 5, true);
+ PMA_cacheSet('test_data_2', 5, true);
+
+ $this->assertTrue(PMA_cacheExists('test_data', true));
+ $this->assertTrue(PMA_cacheExists('test_data_2', 'server'));
+ $this->assertFalse(PMA_cacheExists('fake_data_2', true));
+ }
+
+ /**
+ * Test if cacheGet does not return data for non existing caache entries
+ */
+ public function testCacheGet()
+ {
+ $GLOBALS['server'] = 'server';
+ PMA_cacheSet('test_data', 5, true);
+ PMA_cacheSet('test_data_2', 5, true);
+
+ $this->assertNotNull(PMA_cacheGet('test_data', true));
+ $this->assertNotNull(PMA_cacheGet('test_data_2', 'server'));
+ $this->assertNull(PMA_cacheGet('fake_data_2', true));
+ }
+
+ /**
+ * Test retrieval of cached data
+ */
+ public function testCacheSetGet()
+ {
+ $GLOBALS['server'] = 'server';
+ PMA_cacheSet('test_data', 25, true);
+
+ PMA_cacheSet('test_data', 5, true);
+ $this->assertEquals(5, $_SESSION['cache']['server_server']['test_data']);
+ PMA_cacheSet('test_data_3', 3, true);
+ $this->assertEquals(3, $_SESSION['cache']['server_server']['test_data_3']);
+ }
+
+ /**
+ * Test clearing cached values
+ */
+ public function testCacheUnSet()
+ {
+ $GLOBALS['server'] = 'server';
+ PMA_cacheSet('test_data', 25, true);
+ PMA_cacheSet('test_data_2', 25, true);
+
+ PMA_cacheUnset('test_data', true);
+ $this->assertArrayNotHasKey('test_data', $_SESSION['cache']['server_server']);
+ PMA_cacheUnset('test_data_2', true);
+ $this->assertArrayNotHasKey('test_data_2', $_SESSION['cache']['server_server']);
+ }
+
+ /**
+ * Test clearing user cache
+ */
+ public function testClearUserCache()
+ {
+ $GLOBALS['server'] = 'server';
+ PMA_cacheSet('is_superuser', 'yes', true);
+ $this->assertEquals('yes', $_SESSION['cache']['server_server']['is_superuser']);
+
+ PMA_clearUserCache();
+ $this->assertArrayNotHasKey('is_superuser', $_SESSION['cache']['server_server']);
+ }
+}
+?>
diff --git a/test/libraries/common/PMA_checkParameters_test.php b/test/libraries/common/PMA_checkParameters_test.php
new file mode 100644
index 0000000..f72b880
--- /dev/null
+++ b/test/libraries/common/PMA_checkParameters_test.php
@@ -0,0 +1,46 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_checkParameters from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_checkParameters_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+require_once 'libraries/Theme.class.php';
+
+class PMA_checkParameters_test extends PHPUnit_Extensions_OutputTestCase
+{
+ function setup()
+ {
+ $GLOBALS['PMA_Config'] = new PMA_Config();
+ $_SESSION['PMA_Theme'] = new PMA_Theme();
+ }
+
+ function testCheckParameterMissing()
+ {
+ $GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
+ $GLOBALS['pmaThemePath'] = $_SESSION['PMA_Theme']->getPath();
+
+ $this->expectOutputRegex("/Missing parameter: field/" );
+
+ PMA_checkParameters(array('db', 'table', 'field'), false);
+ }
+
+ function testCheckParameter()
+ {
+ $GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
+ $GLOBALS['pmaThemePath'] = $_SESSION['PMA_Theme']->getPath();
+ $GLOBALS['table'] = "tblTable";
+ $GLOBALS['field'] = "test_field";
+ $GLOBALS['sql_query'] = "SELECT * FROM tblTable;";
+
+ $this->expectOutputString("");
+ PMA_checkParameters(array('db', 'table', 'field', 'sql_query'), false);
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_contains_nonprintable_ascii_test.php b/test/libraries/common/PMA_contains_nonprintable_ascii_test.php
new file mode 100644
index 0000000..8f4059e
--- /dev/null
+++ b/test/libraries/common/PMA_contains_nonprintable_ascii_test.php
@@ -0,0 +1,37 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_contains_nonprintable_ascii from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_contains_nonprintable_ascii.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_contains_nonprintable_ascii extends PHPUnit_Framework_TestCase{
+
+ function dataProvider(){
+ return array(
+ array("normal string", 0),
+ array("new\nline", 1),
+ array("tab\tspace", 1),
+ array("escape" . chr(27) . "char", 1),
+ array("chars%$\r\n",1),
+ );
+ }
+
+ /**
+ * @dataProvider dataProvider
+ */
+ function testContainsNonPrintableAscii($str, $res){
+ $this->assertEquals($res,PMA_contains_nonprintable_ascii($str));
+ }
+
+}
+
+// PMA_contains_nonprintable_ascii
\ No newline at end of file
diff --git a/test/libraries/common/PMA_convert_bit_default_value_test.php b/test/libraries/common/PMA_convert_bit_default_value_test.php
new file mode 100644
index 0000000..d54ab2d
--- /dev/null
+++ b/test/libraries/common/PMA_convert_bit_default_value_test.php
@@ -0,0 +1,33 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_convert_bit_default_value from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_convert_bit_default_value_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_convert_bit_default_value_test extends PHPUnit_Framework_TestCase{
+
+ function dataProvider(){
+ return array(
+ array("b'",""),
+ array("b'01'","01"),
+ array("b'010111010'","010111010")
+ );
+ }
+
+ /**
+ * @dataProvider dataProvider
+ */
+ function testConvert_bit_default_value_test($bit, $val){
+ $this->assertEquals($val, PMA_convert_bit_default_value($bit));
+
+ }
+}
diff --git a/test/libraries/common/PMA_displayMaximumUploadSize_test.php b/test/libraries/common/PMA_displayMaximumUploadSize_test.php
new file mode 100644
index 0000000..ad93ddb
--- /dev/null
+++ b/test/libraries/common/PMA_displayMaximumUploadSize_test.php
@@ -0,0 +1,41 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_displayMaximumUploadSize from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_displayMaximumUploadSize_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_displayMaximumUploadSize_test extends PHPUnit_Framework_TestCase{
+
+ /*
+ * Data provider for test
+ */
+ public function dataProvider() {
+ return array(
+ array(10, __('B'), "10"),
+ array(100, __('B'), "100"),
+ array(1024, __('B'), "1,024"),
+ array(102400, __('KiB'), "100"),
+ array(10240000, __('MiB'), "10"),
+ array(2147483648, __('MiB'), "2,048"),
+ array(21474836480, __('GiB'), "20")
+ );
+ }
+
+ /**
+ * @dataProvider dataProvider
+ * @return void
+ */
+ function testMaximumUploadSize($size, $unit, $res){
+ $this->assertEquals("(" . __('Max: '). $res . $unit .")", PMA_displayMaximumUploadSize($size));
+
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_display_html_checkbox_test.php b/test/libraries/common/PMA_display_html_checkbox_test.php
new file mode 100644
index 0000000..c779d72
--- /dev/null
+++ b/test/libraries/common/PMA_display_html_checkbox_test.php
@@ -0,0 +1,55 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_display_html_checkbox from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_display_html_checkbox_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_display_html_checkbox_test extends PHPUnit_Extensions_OutputTestCase
+{
+ function testDisplayHtmlCheckbox()
+ {
+ $name = "test_display_html_checkbox";
+ $label = "text_label_for_checkbox";
+
+ $this->expectOutputString('<input type="checkbox" name="' . $name . '" id="' . $name . '" /><label for="' . $name . '">' . $label . '</label>');
+ PMA_display_html_checkbox($name,$label,false,false);
+ }
+
+ function testDisplayHtmlCheckboxChecked()
+ {
+ $name = "test_display_html_checkbox";
+ $label = "text_label_for_checkbox";
+
+ $this->expectOutputString('<input type="checkbox" name="' . $name . '" id="' . $name . '" checked="checked" /><label for="' . $name . '">' . $label . '</label>');
+ PMA_display_html_checkbox($name,$label,true,false);
+ }
+
+ function testDisplayHtmlCheckboxOnclick()
+ {
+ $name = "test_display_html_checkbox";
+ $label = "text_label_for_checkbox";
+
+ $this->expectOutputString('<input type="checkbox" name="' . $name . '" id="' . $name . '" onclick="this.form.submit();" /><label for="' . $name . '">' . $label . '</label>');
+ PMA_display_html_checkbox($name,$label,false,true);
+ }
+
+ function testDisplayHtmlCheckboxCheckedOnclick()
+ {
+ $name = "test_display_html_checkbox";
+ $label = "text_label_for_checkbox";
+
+ $this->expectOutputString('<input type="checkbox" name="' . $name . '" id="' . $name . '" checked="checked" onclick="this.form.submit();" /><label for="' . $name . '">' . $label . '</label>');
+ PMA_display_html_checkbox($name,$label,true,true);
+ }
+}
+
+//PMA_display_html_checkbox
\ No newline at end of file
diff --git a/test/libraries/common/PMA_display_html_radio_test.php b/test/libraries/common/PMA_display_html_radio_test.php
new file mode 100644
index 0000000..c5f2d4b
--- /dev/null
+++ b/test/libraries/common/PMA_display_html_radio_test.php
@@ -0,0 +1,188 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_display_html_radio from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_display_html_radio_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_display_html_radio_test extends PHPUnit_Extensions_OutputTestCase
+{
+ function testDisplayHtmlRadioEmpty()
+ {
+ $name = "test_display_radio";
+ $choices = array();
+
+ $this->expectOutputString("");
+ PMA_display_html_radio($name,$choices);
+ }
+
+ function testDisplayHtmlRadio()
+ {
+ $name = "test_display_radio";
+ $choices = array('value_1'=>'choice_1', 'value_2'=>'choice_2');
+
+ $out = "";
+ foreach ($choices as $choice_value => $choice_label) {
+ $html_field_id = $name . '_' . $choice_value;
+ $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
+ $out .= ' />' . "\n";
+ $out .= '<label for="' . $html_field_id . '">' . $choice_label . '</label>';
+ $out .= '<br />';
+ $out .= "\n";
+ }
+
+ $this->expectOutputString($out);
+ PMA_display_html_radio($name,$choices);
+ }
+
+ function testDisplayHtmlRadioWithChecked()
+ {
+ $name = "test_display_radio";
+ $choices = array('value_1'=>'choice_1', 'value_2'=>'choice_2');
+ $checked_choice = "value_2";
+
+ $out = "";
+ foreach ($choices as $choice_value => $choice_label) {
+ $html_field_id = $name . '_' . $choice_value;
+ $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
+ if ($choice_value == $checked_choice) {
+ $out .= ' checked="checked"';
+ }
+ $out .= ' />' . "\n";
+ $out .= '<label for="' . $html_field_id . '">' . $choice_label . '</label>';
+ $out .= '<br />';
+ $out .= "\n";
+ }
+
+ $this->expectOutputString($out);
+ PMA_display_html_radio($name,$choices,$checked_choice);
+ }
+
+ function testDisplayHtmlRadioWithCheckedWithClass()
+ {
+ $name = "test_display_radio";
+ $choices = array('value_1'=>'choice_1', 'value_2'=>'choice_2');
+ $checked_choice = "value_2";
+ $class = "test_class";
+
+ $out = "";
+ foreach ($choices as $choice_value => $choice_label) {
+ $html_field_id = $name . '_' . $choice_value;
+ $out .= '<div class="' . $class . '">';
+ $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
+ if ($choice_value == $checked_choice) {
+ $out .= ' checked="checked"';
+ }
+ $out .= ' />' . "\n";
+ $out .= '<label for="' . $html_field_id . '">' . $choice_label . '</label>';
+ $out .= '<br />';
+ $out .= '</div>';
+ $out .= "\n";
+ }
+
+ $this->expectOutputString($out);
+ PMA_display_html_radio($name,$choices,$checked_choice,true,false,$class);
+ }
+
+ function testDisplayHtmlRadioWithoutBR()
+ {
+ $name = "test_display_radio";
+ $choices = array('value_1'=>'choice_1', 'value&_<2>'=>'choice_2');
+ $checked_choice = "choice_2";
+
+ $out = "";
+ foreach ($choices as $choice_value => $choice_label) {
+ $html_field_id = $name . '_' . $choice_value;
+ $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
+ if ($choice_value == $checked_choice) {
+ $out .= ' checked="checked"';
+ }
+ $out .= ' />' . "\n";
+ $out .= '<label for="' . $html_field_id . '">' . $choice_label . '</label>';
+ $out .= "\n";
+ }
+
+ $this->expectOutputString($out);
+ PMA_display_html_radio($name,$choices,$checked_choice,false);
+ }
+
+ function testDisplayHtmlRadioEscapeLabelEscapeLabel()
+ {
+ $name = "test_display_radio";
+ $choices = array('value_1'=>'choice_1', 'value_&2'=>'choice&_<2>');
+ $checked_choice = "value_2";
+
+ $out = "";
+ foreach ($choices as $choice_value => $choice_label) {
+ $html_field_id = $name . '_' . $choice_value;
+ $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
+ if ($choice_value == $checked_choice) {
+ $out .= ' checked="checked"';
+ }
+ $out .= ' />' . "\n";
+ $out .= '<label for="' . $html_field_id . '">' . htmlspecialchars($choice_label) . '</label>';
+ $out .= '<br />';
+ $out .= "\n";
+ }
+
+ $this->expectOutputString($out);
+ PMA_display_html_radio($name,$choices,$checked_choice,true,true);
+ }
+
+ function testDisplayHtmlRadioEscapeLabelNotEscapeLabel()
+ {
+ $name = "test_display_radio";
+ $choices = array('value_1'=>'choice_1', 'value_&2'=>'choice&_<2>');
+ $checked_choice = "value_2";
+
+ $out = "";
+ foreach ($choices as $choice_value => $choice_label) {
+ $html_field_id = $name . '_' . $choice_value;
+ $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
+ if ($choice_value == $checked_choice) {
+ $out .= ' checked="checked"';
+ }
+ $out .= ' />' . "\n";
+ $out .= '<label for="' . $html_field_id . '">' . $choice_label . '</label>';
+ $out .= '<br />';
+ $out .= "\n";
+ }
+
+ $this->expectOutputString($out);
+ PMA_display_html_radio($name,$choices,$checked_choice,true,false);
+ }
+
+ function testDisplayHtmlRadioEscapeLabelEscapeLabelWithClass()
+ {
+ $name = "test_display_radio";
+ $choices = array('value_1'=>'choice_1', 'value_&2'=>'choice&_<2>');
+ $checked_choice = "value_2";
+ $class = "test_class";
+
+ $out = "";
+ foreach ($choices as $choice_value => $choice_label) {
+ $html_field_id = $name . '_' . $choice_value;
+ $out .= '<div class="' . $class . '">';
+ $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
+ if ($choice_value == $checked_choice) {
+ $out .= ' checked="checked"';
+ }
+ $out .= ' />' . "\n";
+ $out .= '<label for="' . $html_field_id . '">' . htmlspecialchars($choice_label) . '</label>';
+ $out .= '<br />';
+ $out .= '</div>';
+ $out .= "\n";
+ }
+
+ $this->expectOutputString($out);
+ PMA_display_html_radio($name,$choices,$checked_choice,true,true,$class);
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_escapeMySqlWildcards_test.php b/test/libraries/common/PMA_escapeMySqlWildcards_test.php
new file mode 100644
index 0000000..c77a841
--- /dev/null
+++ b/test/libraries/common/PMA_escapeMySqlWildcards_test.php
@@ -0,0 +1,52 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for MySQL Wildcards escaping/unescaping
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_escapeMySqlWildcards_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_escapeMySqlWildcards_test extends PHPUnit_Framework_TestCase
+{
+
+ public function escapeDataProvider() {
+ return array(
+ array('\_test', '_test'),
+ array('\_\\', '_\\'),
+ array('\\_\%', '_%'),
+ array('\\\_', '\_'),
+ array('\\\_\\\%', '\_\%'),
+ array('\_\\%\_\_\%', '_%__%'),
+ array('\%\_', '%_'),
+ array('\\\%\\\_', '\%\_')
+ );
+ }
+
+ /**
+ * PMA_escape_mysql_wildcards tests
+ * @dataProvider escapeDataProvider
+ */
+
+ public function testEscape($a, $b)
+ {
+ $this->assertEquals($a, PMA_escape_mysql_wildcards($b));
+ }
+
+ /**
+ * PMA_unescape_mysql_wildcards tests
+ * @dataProvider escapeDataProvider
+ */
+
+ public function testUnEscape($a, $b)
+ {
+ $this->assertEquals($b, PMA_unescape_mysql_wildcards($a));
+ }
+}
+?>
diff --git a/test/libraries/common/PMA_extractValueFromFormattedSize_test.php b/test/libraries/common/PMA_extractValueFromFormattedSize_test.php
new file mode 100644
index 0000000..038a36e
--- /dev/null
+++ b/test/libraries/common/PMA_extractValueFromFormattedSize_test.php
@@ -0,0 +1,37 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_extractValueFromFormattedSize from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_extractValueFromFormattedSize_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_extractValueFromFormattedSize_test extends PHPUnit_Framework_TestCase{
+
+ function testExtractValueFromFormattedSizeNoFormat(){
+
+ $this->assertEquals(-1,PMA_extractValueFromFormattedSize(100));
+ }
+
+ function testExtractValueFromFormattedSizeGB(){
+
+ $this->assertEquals(10737418240,PMA_extractValueFromFormattedSize("10GB"));
+ }
+
+ function testExtractValueFromFormattedSizeMB(){
+
+ $this->assertEquals(15728640,PMA_extractValueFromFormattedSize("15MB"));
+ }
+
+ function testExtractValueFromFormattedSizeK(){
+
+ $this->assertEquals(262144,PMA_extractValueFromFormattedSize("256K"));
+ }
+}
diff --git a/test/libraries/common/PMA_foreignKeySupported_test.php b/test/libraries/common/PMA_foreignKeySupported_test.php
new file mode 100644
index 0000000..e0ebd2e
--- /dev/null
+++ b/test/libraries/common/PMA_foreignKeySupported_test.php
@@ -0,0 +1,37 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for supporting foreign key
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_foreignKeySupported_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_foreignKeySupported_test extends PHPUnit_Framework_TestCase
+{
+ /**
+ * data provider for foreign key supported test
+ */
+ public function foreignkeySupportedDataProvider() {
+ return array(
+ array('MyISAM', false),
+ array('innodb', true),
+ array('pBxT', true)
+ );
+ }
+
+ /**
+ * foreign key supported test
+ * @dataProvider foreignkeySupportedDataProvider
+ */
+ public function testForeignkeySupported($a, $e) {
+ $this->assertEquals($e, PMA_foreignkey_supported($a));
+ }
+}
+?>
diff --git a/test/libraries/common/PMA_formatNumberByteDown_test.php b/test/libraries/common/PMA_formatNumberByteDown_test.php
new file mode 100644
index 0000000..f0265c6
--- /dev/null
+++ b/test/libraries/common/PMA_formatNumberByteDown_test.php
@@ -0,0 +1,98 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for format number and byte
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_formatNumberByteDown_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_formatNumberByteDown_test extends PHPUnit_Framework_TestCase
+{
+ /**
+ * temporary variable for globals array
+ */
+ protected $tmpGlobals;
+
+ /**
+ * temporary variable for session array
+ */
+ protected $tmpSession;
+
+ /**
+ * storing globals and session
+ */
+ public function setUp() {
+
+ $this->tmpGlobals = $GLOBALS;
+ $this->tmpSession = $_SESSION;
+
+ }
+
+ /**
+ * recovering globals and session
+ */
+ public function tearDown() {
+
+ $GLOBALS = $this->tmpGlobals;
+ $_SESSION = $this->tmpSession;
+
+ }
+
+ /**
+ * format number data provider
+ */
+
+ public function formatNumberDataProvider() {
+ return array(
+ array(10, 2, 2, '10 '),
+ array(100, 2, 0, '100 '),
+ array(100, 2, 2, '100 '),
+ array(-1000.454, 4, 2, '-1,000.45 '),
+ array(0.00003, 3, 2, '30 µ'),
+ array(0.003, 3, 3, '3 m'),
+ array(-0.003, 6, 0, '-3,000 µ'),
+ array(100.98, 0, 2, '100.98')
+ );
+ }
+
+ /**
+ * format number test, globals are defined
+ * @dataProvider formatNumberDataProvider
+ */
+ public function testFormatNumber($a, $b, $c, $d) {
+ $this->assertEquals($d, (string)PMA_formatNumber($a, $b, $c, false));
+ }
+
+ /**
+ * format byte down data provider
+ */
+ public function formatByteDownDataProvider() {
+ return array(
+ array(10, 2, 2, array('10', __('B'))),
+ array(100, 2, 0, array('0', __('KiB'))),
+ array(100, 3, 0, array('100', __('B'))),
+ array(100, 2, 2, array('0.10', __('KiB'))),
+ array(1034, 3, 2, array('1.01', __('KiB'))),
+ array(100233, 3, 3, array('97.884', __('KiB'))),
+ array(2206451, 1, 2, array('2.10', __('MiB')))
+ );
+ }
+
+ /**
+ * format byte test, globals are defined
+ * @dataProvider formatByteDownDataProvider
+ */
+ public function testFormatByteDown($a, $b, $c, $e) {
+ $result = PMA_formatByteDown($a, $b, $c);
+ $result[0] = trim($result[0]);
+ $this->assertEquals($e, $result);
+ }
+}
+?>
diff --git a/test/libraries/common/PMA_formatSql_test.php b/test/libraries/common/PMA_formatSql_test.php
new file mode 100644
index 0000000..df0ddc4
--- /dev/null
+++ b/test/libraries/common/PMA_formatSql_test.php
@@ -0,0 +1,744 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_formatSql from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_formatSql_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+require_once 'libraries/sqlparser.lib.php';
+
+class PMA_formatSql_test extends PHPUnit_Framework_TestCase{
+
+ /**
+ * temporary variable for globals array
+ */
+ protected $tmpCfg;
+
+ /**
+ * temporary variable for session array
+ */
+ protected $tmpSession;
+
+ /**
+ * storing globals and session
+ */
+ public function setUp() {
+ global $cfg;
+ $this->tmpCfg = $cfg;
+ }
+
+ /**
+ * recovering globals and session
+ */
+ public function tearDown() {
+ global $cfg;
+ $cfg = $this->tmpCfg;
+ }
+
+ function testFormatSQLNotArray(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'html';
+ $sql = "SELECT * FROM tTable;";
+ $this->assertEquals("<pre>\n$sql\n</pre>",PMA_formatSql($sql));
+ }
+
+ function testFormatSQLfmTypeHtml_1(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'html';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $sql = array (
+ 'raw' => 'SELECT 1;',
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'digit_integer',
+ 'data' => '1',
+ 'pos' => 8,
+ ),
+ 2 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 3,
+ );
+ $unparsed = "SELECT 1;";
+ $expected = '<span class="syntax"><span class="inner_sql"><span class="syntax_alpha syntax_alpha_reservedWord">SELECT</span></a> <span class="syntax_digit syntax_digit_integer">1</span> <span class="syntax_punct syntax_punct_queryend">;</span><br /><br /></span></span>';
+
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+ }
+
+ function testFormatSQLfmTypeHtml_2(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'html';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $unparsed = "SELECT * from `tTable`;";
+ $sql = array (
+ 'raw' => $unparsed,
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'from',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 5,
+ );
+ $expected = '<span class="syntax"><span class="inner_sql"><span class="syntax_alpha syntax_alpha_reservedWord">SELECT</span></a> <span class="syntax_punct">*</span> <br /><span class="syntax_alpha syntax_alpha_reservedWord">FROM</span> <span class="syntax_quote syntax_quote_backtick">`tTable`</span> <span class="syntax_punct syntax_punct_queryend">;</span><br /><br /></span></span>';
+
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+ }
+
+ function testFormatSQLfmTypeHtml_3(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'html';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $unparsed = 'SELECT * FROM `tTable_A` A INNER JOIN `tTable_B` B ON B.ID = A.ID;';
+ $sql = array (
+ 'raw' => $unparsed,
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'FROM',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable_A`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'A',
+ 'pos' => 26,
+ 'forbidden' => false,
+ ),
+ 5 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'INNER',
+ 'pos' => 32,
+ 'forbidden' => true,
+ ),
+ 6 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'JOIN',
+ 'pos' => 37,
+ 'forbidden' => true,
+ ),
+ 7 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable_B`',
+ 'pos' => 0,
+ ),
+ 8 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'B',
+ 'pos' => 50,
+ 'forbidden' => false,
+ ),
+ 9 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'ON',
+ 'pos' => 53,
+ 'forbidden' => true,
+ ),
+ 10 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'B',
+ 'pos' => 55,
+ 'forbidden' => false,
+ ),
+ 11 =>
+ array (
+ 'type' => 'punct_qualifier',
+ 'data' => '.',
+ 'pos' => 0,
+ ),
+ 12 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'ID',
+ 'pos' => 58,
+ 'forbidden' => false,
+ ),
+ 13 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '=',
+ 'pos' => 0,
+ ),
+ 14 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'A',
+ 'pos' => 62,
+ 'forbidden' => false,
+ ),
+ 15 =>
+ array (
+ 'type' => 'punct_qualifier',
+ 'data' => '.',
+ 'pos' => 0,
+ ),
+ 16 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'ID',
+ 'pos' => 65,
+ 'forbidden' => false,
+ ),
+ 17 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 18,
+ );
+
+ $expected = '<span class="syntax"><span class="inner_sql"><span class="syntax_alpha syntax_alpha_reservedWord">SELECT</span></a> <span class="syntax_punct">*</span> <br /><span class="syntax_alpha syntax_alpha_reservedWord">FROM</span> <span class="syntax_quote syntax_quote_backtick">`tTable_A`</span> <span class="syntax_alpha syntax_alpha_identifier">A</span><br /><span class="syntax_alpha syntax_alpha_reservedWord">INNER</span> <span class="syntax_alpha syntax_alpha_reservedWord">JOIN</span> <span class="syntax_quote syntax_quote_backtick">`tTable_B`</span> <span class="syntax_alpha syntax_alpha_identifier">B</span> <span class="syntax_alpha syntax_alpha_reservedWord">ON</span> <span class="syntax_alpha syntax_alpha_identifier">B</span><span class="syntax_punct syntax_punct_qualifier">.</span><span class="syntax_alpha syntax_alpha_identifier">ID</span> <span class="syntax_punct">=</span></a> <span class="syntax_alpha syntax_alpha_identifier">A</span><span class="syntax_punct syntax_punct_qualifier">.</span><span class="syntax_alpha syntax_alpha_identifier">ID</span><span class="syntax_punct syntax_punct_queryend">;</span><br /><br /></span></span>';
+
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+ }
+
+ function testFormatSQLfmTypeText_1(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'text';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $sql = array (
+ 'raw' => 'SELECT 1;',
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'digit_integer',
+ 'data' => '1',
+ 'pos' => 8,
+ ),
+ 2 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 3,
+ );
+ $unparsed = "SELECT 1;";
+ $expected = '<span class="inner_sql">SELECT</a> 1 ;<br /><br /></span>';
+
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+ }
+
+ function testFormatSQLfmTypeText_2(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'text';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $unparsed = "SELECT * from `tTable`;";
+ $sql = array (
+ 'raw' => $unparsed,
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'from',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 5,
+ );
+ $expected = '<span class="inner_sql">SELECT</a> * <br />FROM `tTable` ;<br /><br /></span>';
+
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+ }
+
+ function testFormatSQLfmTypeText_3(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'text';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $unparsed = 'SELECT * FROM `tTable_A` A INNER JOIN `tTable_B` B ON B.ID = A.ID;';
+ $sql = array (
+ 'raw' => $unparsed,
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'FROM',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable_A`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'A',
+ 'pos' => 26,
+ 'forbidden' => false,
+ ),
+ 5 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'INNER',
+ 'pos' => 32,
+ 'forbidden' => true,
+ ),
+ 6 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'JOIN',
+ 'pos' => 37,
+ 'forbidden' => true,
+ ),
+ 7 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable_B`',
+ 'pos' => 0,
+ ),
+ 8 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'B',
+ 'pos' => 50,
+ 'forbidden' => false,
+ ),
+ 9 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'ON',
+ 'pos' => 53,
+ 'forbidden' => true,
+ ),
+ 10 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'B',
+ 'pos' => 55,
+ 'forbidden' => false,
+ ),
+ 11 =>
+ array (
+ 'type' => 'punct_qualifier',
+ 'data' => '.',
+ 'pos' => 0,
+ ),
+ 12 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'ID',
+ 'pos' => 58,
+ 'forbidden' => false,
+ ),
+ 13 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '=',
+ 'pos' => 0,
+ ),
+ 14 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'A',
+ 'pos' => 62,
+ 'forbidden' => false,
+ ),
+ 15 =>
+ array (
+ 'type' => 'punct_qualifier',
+ 'data' => '.',
+ 'pos' => 0,
+ ),
+ 16 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'ID',
+ 'pos' => 65,
+ 'forbidden' => false,
+ ),
+ 17 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 18,
+ );
+ $expected = '<span class="inner_sql">SELECT</a> * <br />FROM `tTable_A` A<br />INNER JOIN `tTable_B` B ON B.ID =</a> A.ID;<br /><br /></span>';
+
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+ }
+
+ function testFormatSQLfmTypeNone_1(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'none';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $sql = array (
+ 'raw' => 'SELECT 1;',
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'digit_integer',
+ 'data' => '1',
+ 'pos' => 8,
+ ),
+ 2 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 3,
+ );
+ $unparsed = "SELECT 1;";
+
+ $expected = "<span class=\"inner_sql\"><pre>\nSELECT 1;\n</pre></span>";
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+
+ $expected = "SELECT 1;";
+ $this->assertEquals($expected,PMA_formatSql($sql));
+ }
+
+ function testFormatSQLfmTypeNone_2(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'none';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $unparsed = "SELECT * from `tTable`;";
+ $sql = array (
+ 'raw' => $unparsed,
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'from',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 5,
+ );
+
+ $expected = "<span class=\"inner_sql\"><pre>\nSELECT * from `tTable`;\n</pre></span>";
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+
+ $expected = "SELECT * from `tTable`;";
+ $this->assertEquals($expected,PMA_formatSql($sql));
+ }
+
+ function testFormatSQLfmTypeNone_3(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = 'none';
+ $cfg['MySQLManualType'] = 'viewable';
+
+ $unparsed = 'SELECT * FROM `tTable_A` A INNER JOIN `tTable_B` B ON B.ID = A.ID;';
+ $sql = array (
+ 'raw' => $unparsed,
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '*',
+ 'pos' => 0,
+ ),
+ 2 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'FROM',
+ 'pos' => 13,
+ 'forbidden' => true,
+ ),
+ 3 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable_A`',
+ 'pos' => 0,
+ ),
+ 4 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'A',
+ 'pos' => 26,
+ 'forbidden' => false,
+ ),
+ 5 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'INNER',
+ 'pos' => 32,
+ 'forbidden' => true,
+ ),
+ 6 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'JOIN',
+ 'pos' => 37,
+ 'forbidden' => true,
+ ),
+ 7 =>
+ array (
+ 'type' => 'quote_backtick',
+ 'data' => '`tTable_B`',
+ 'pos' => 0,
+ ),
+ 8 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'B',
+ 'pos' => 50,
+ 'forbidden' => false,
+ ),
+ 9 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'ON',
+ 'pos' => 53,
+ 'forbidden' => true,
+ ),
+ 10 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'B',
+ 'pos' => 55,
+ 'forbidden' => false,
+ ),
+ 11 =>
+ array (
+ 'type' => 'punct_qualifier',
+ 'data' => '.',
+ 'pos' => 0,
+ ),
+ 12 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'ID',
+ 'pos' => 58,
+ 'forbidden' => false,
+ ),
+ 13 =>
+ array (
+ 'type' => 'punct',
+ 'data' => '=',
+ 'pos' => 0,
+ ),
+ 14 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'A',
+ 'pos' => 62,
+ 'forbidden' => false,
+ ),
+ 15 =>
+ array (
+ 'type' => 'punct_qualifier',
+ 'data' => '.',
+ 'pos' => 0,
+ ),
+ 16 =>
+ array (
+ 'type' => 'alpha_identifier',
+ 'data' => 'ID',
+ 'pos' => 65,
+ 'forbidden' => false,
+ ),
+ 17 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 18,
+ );
+
+ $expected = "<span class=\"inner_sql\"><pre>\nSELECT * FROM `tTable_A` A INNER JOIN `tTable_B` B ON B.ID = A.ID;\n</pre></span>";
+ $this->assertEquals($expected,PMA_formatSql($sql, $unparsed));
+
+ $expected = 'SELECT * FROM `tTable_A` A INNER JOIN `tTable_B` B ON B.ID = A.ID;';
+ $this->assertEquals($expected,PMA_formatSql($sql));
+ }
+
+ function testFormatSQLWithoutType(){
+ global $cfg;
+ $cfg['SQP']['fmtType'] = '';
+ $cfg['MySQLManualType'] = 'viewable';
+ $sql = array (
+ 'raw' => 'SELECT 1;',
+ 0 =>
+ array (
+ 'type' => 'alpha_reservedWord',
+ 'data' => 'SELECT',
+ 'pos' => 6,
+ 'forbidden' => true,
+ ),
+ 1 =>
+ array (
+ 'type' => 'digit_integer',
+ 'data' => '1',
+ 'pos' => 8,
+ ),
+ 2 =>
+ array (
+ 'type' => 'punct_queryend',
+ 'data' => ';',
+ 'pos' => 0,
+ ),
+ 'len' => 3,
+ );
+ $this->assertEmpty(PMA_formatSql($sql));
+ }
+
+ function testFormatSQLError(){
+ global $SQP_errorString;
+ $SQP_errorString = true;
+ $sql = array("raw" => "& \" < >");
+ $this->assertEquals("& " < >",PMA_formatSql($sql));
+ $SQP_errorString = false;
+ }
+}
diff --git a/test/libraries/common/PMA_generateHiddenMaxFileSize_test.php b/test/libraries/common/PMA_generateHiddenMaxFileSize_test.php
new file mode 100644
index 0000000..3cd6810
--- /dev/null
+++ b/test/libraries/common/PMA_generateHiddenMaxFileSize_test.php
@@ -0,0 +1,40 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_generateHiddenMaxFileSize from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_generateHiddenMaxFileSize_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_generateHiddenMaxFileSize_test extends PHPUnit_Framework_TestCase{
+
+ /*
+ * Data provider for test
+ */
+ public function dataProvider() {
+ return array(
+ array(10),
+ array("100"),
+ array(1024),
+ array("1024Mb"),
+ array(2147483648),
+ array("some_string")
+ );
+ }
+
+ /**
+ * @dataProvider dataProvider
+ * @return void
+ */
+ function test_generateHiddenMaxFileSize($size){
+ $this->assertEquals(PMA_generateHiddenMaxFileSize($size),
+ '<input type="hidden" name="MAX_FILE_SIZE" value="' .$size . '" />');
+ }
+}
diff --git a/test/libraries/common/PMA_generate_html_dropdown_test.php b/test/libraries/common/PMA_generate_html_dropdown_test.php
new file mode 100644
index 0000000..8e27c20
--- /dev/null
+++ b/test/libraries/common/PMA_generate_html_dropdown_test.php
@@ -0,0 +1,69 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_generate_html_dropdown_test from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_display_html_checkbox_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_generate_html_dropdown_test extends PHPUnit_Framework_TestCase
+{
+ function testGenerateHtmlDropdownEmpty()
+ {
+ $name = "test_dropdown_name";
+ $choices = array();
+ $active_choice = null;
+ $id = "test_<dropdown>_name";
+
+ $result = '<select name="' . htmlspecialchars($name) . '" id="' . htmlspecialchars($id) . '"></select>';
+
+ $this->assertEquals($result, PMA_generate_html_dropdown($name,$choices,$active_choice,$id));
+ }
+
+ function testGenerateHtmlDropdown()
+ {
+ $name = "&test_dropdown_name";
+ $choices = array("value_1" => "label_1", "value&_2\"" => "label_2");
+ $active_choice = null;
+ $id = "test_<dropdown>_name";
+
+ $result = '<select name="' . htmlspecialchars($name) . '" id="' . htmlspecialchars($id) . '">';
+ foreach ($choices as $one_choice_value => $one_choice_label) {
+ $result .= '<option value="' . htmlspecialchars($one_choice_value) . '"';
+ if ($one_choice_value == $active_choice) {
+ $result .= ' selected="selected"';
+ }
+ $result .= '>' . htmlspecialchars($one_choice_label) . '</option>';
+ }
+ $result .= '</select>';
+
+ $this->assertEquals($result, PMA_generate_html_dropdown($name,$choices,$active_choice,$id));
+ }
+
+ function testGenerateHtmlDropdownWithActive()
+ {
+ $name = "&test_dropdown_name";
+ $choices = array("value_1" => "label_1", "value&_2\"" => "label_2");
+ $active_choice = "value&_2\"";
+ $id = "test_<dropdown>_name";
+
+ $result = '<select name="' . htmlspecialchars($name) . '" id="' . htmlspecialchars($id) . '">';
+ foreach ($choices as $one_choice_value => $one_choice_label) {
+ $result .= '<option value="' . htmlspecialchars($one_choice_value) . '"';
+ if ($one_choice_value == $active_choice) {
+ $result .= ' selected="selected"';
+ }
+ $result .= '>' . htmlspecialchars($one_choice_label) . '</option>';
+ }
+ $result .= '</select>';
+
+ $this->assertEquals($result, PMA_generate_html_dropdown($name,$choices,$active_choice,$id));
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_generate_slider_effect_test.php b/test/libraries/common/PMA_generate_slider_effect_test.php
new file mode 100644
index 0000000..62458be
--- /dev/null
+++ b/test/libraries/common/PMA_generate_slider_effect_test.php
@@ -0,0 +1,53 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_generate_slider_effect from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_generate_slider_effect_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_generate_slider_effect_test extends PHPUnit_Extensions_OutputTestCase
+{
+ function testGenerateSliderEffectTest()
+ {
+ global $cfg;
+ $cfg['InitialSlidersState'] = 'undefined';
+
+ $id = "test_id";
+ $message = "test_message";
+
+ $this->expectOutputString('<div id="' . $id . '" class="pma_auto_slider" title="' . htmlspecialchars($message) . '">' . "\n" . ' ');
+ PMA_generate_slider_effect($id,$message);
+ }
+
+ function testGenerateSliderEffectTestClosed()
+ {
+ global $cfg;
+ $cfg['InitialSlidersState'] = 'closed';
+
+ $id = "test_id";
+ $message = "test_message";
+
+ $this->expectOutputString('<div id="' . $id . '" style="display: none; overflow:auto;" class="pma_auto_slider" title="' . htmlspecialchars($message) . '">' . "\n" . ' ');
+ PMA_generate_slider_effect($id,$message);
+ }
+
+ function testGenerateSliderEffectTestDisabled()
+ {
+ global $cfg;
+ $cfg['InitialSlidersState'] = 'disabled';
+
+ $id = "test_id";
+ $message = "test_message";
+
+ $this->expectOutputString('<div id="' . $id . '">');
+ PMA_generate_slider_effect($id,$message);
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_getDbLink_test.php b/test/libraries/common/PMA_getDbLink_test.php
new file mode 100644
index 0000000..00053e1
--- /dev/null
+++ b/test/libraries/common/PMA_getDbLink_test.php
@@ -0,0 +1,57 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_getDbLink_test from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_getDbLink_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_getDbLink_test extends PHPUnit_Framework_TestCase
+{
+ function setUp()
+ {
+ global $cfg;
+ require 'libraries/config.default.php';
+ }
+
+ function testGetDbLinkEmpty()
+ {
+ $GLOBALS['db'] = null;
+ $this->assertEmpty(PMA_getDbLink());
+ }
+
+ function testGetDbLinkNull()
+ {
+ global $cfg;
+ $GLOBALS['db'] = 'test_db';
+ $database = $GLOBALS['db'];
+ $this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . $database
+ . '&server=server&lang=en" title="Jump to database "' . htmlspecialchars($database) . '".">'
+ . htmlspecialchars($database) . '</a>',PMA_getDbLink());
+ }
+
+ function testGetDbLink()
+ {
+ global $cfg;
+ $database = 'test_database';
+ $this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . $database
+ . '&server=server&lang=en" title="Jump to database "' . htmlspecialchars($database) . '".">'
+ . htmlspecialchars($database) . '</a>',PMA_getDbLink($database));
+ }
+
+ function testGetDbLinkWithSpecialChars()
+ {
+ global $cfg;
+ $database = 'test&data\'base';
+ $this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . htmlspecialchars(urlencode($database))
+ . '&server=server&lang=en" title="Jump to database "' . htmlspecialchars($database) . '".">'
+ . htmlspecialchars($database) . '</a>',PMA_getDbLink($database));
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_getIcon_test.php b/test/libraries/common/PMA_getIcon_test.php
new file mode 100644
index 0000000..7835aca
--- /dev/null
+++ b/test/libraries/common/PMA_getIcon_test.php
@@ -0,0 +1,74 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_getIcon() from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_getIcon_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_getIcon_test extends PHPUnit_Framework_TestCase{
+
+ function testGetIconWithoutPropertiesIconic(){
+
+ $GLOBALS['cfg']['PropertiesIconic'] = false;
+ $GLOBALS['pmaThemeImage'] = 'theme/';
+
+ $this->assertEquals('<span class="nowrap"></span>',
+ PMA_getIcon('b_comment.png') );
+ }
+
+ function testGetIconWithPropertiesIconic(){
+
+ $GLOBALS['cfg']['PropertiesIconic'] = true;
+ $GLOBALS['pmaThemeImage'] = 'theme/';
+
+ $this->assertEquals('<span class="nowrap"><img src="'.$GLOBALS['pmaThemeImage']
+ . 'b_comment.png" title="" alt="" class="icon" width="16" height="16" /></span>',
+ PMA_getIcon('b_comment.png') );
+ }
+
+ function testGetIconAlternate(){
+
+ $GLOBALS['cfg']['PropertiesIconic'] = true;
+ $GLOBALS['pmaThemeImage'] = 'theme/';
+ $alternate_text = 'alt_str';
+
+ $this->assertEquals('<span class="nowrap"><img src="'.$GLOBALS['pmaThemeImage']
+ .'b_comment.png" title="' . $alternate_text . '" alt="' . $alternate_text
+ . '" class="icon" width="16" height="16" /></span>',
+ PMA_getIcon('b_comment.png',$alternate_text) );
+ }
+
+ function testGetIconWithContainer(){
+
+ $GLOBALS['cfg']['PropertiesIconic'] = true;
+ $GLOBALS['pmaThemeImage'] = 'theme/';
+ $alternate_text = 'alt_str';
+
+ $this->assertEquals('<span class="nowrap"><img src="'.$GLOBALS['pmaThemeImage']
+ .'b_comment.png" title="' . $alternate_text . '" alt="' . $alternate_text
+ . '" class="icon" width="16" height="16" /></span>',
+ PMA_getIcon('b_comment.png',$alternate_text, true) );
+
+ }
+
+ function testGetIconWithContainerAndForceText(){
+
+ $GLOBALS['cfg']['PropertiesIconic'] = true;
+ $GLOBALS['pmaThemeImage'] = 'theme/';
+ $alternate_text = 'alt_str';
+
+ $this->assertEquals('<span class="nowrap"><img src="'.$GLOBALS['pmaThemeImage']
+ .'b_comment.png" title="' . $alternate_text . '" alt="' . $alternate_text
+ . '" class="icon" width="16" height="16" /> ' . $alternate_text . '</span>',
+ PMA_getIcon('b_comment.png',$alternate_text, true, true) );
+
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_getTitleForTarget_test.php b/test/libraries/common/PMA_getTitleForTarget_test.php
new file mode 100644
index 0000000..1756681
--- /dev/null
+++ b/test/libraries/common/PMA_getTitleForTarget_test.php
@@ -0,0 +1,43 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_getTitleForTarget from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_getTitleForTarget_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_getTitleForTarget_test extends PHPUnit_Framework_TestCase{
+
+ function dataProvider(){
+ return array(
+ array('tbl_structure.php', __('Structure')),
+ array('tbl_sql.php', __('SQL'),),
+ array('tbl_select.php', __('Search'),),
+ array('tbl_change.php', __('Insert')),
+ array('sql.php', __('Browse')),
+ array('db_structure.php', __('Structure')),
+ array('db_sql.php', __('SQL')),
+ array('db_search.php', __('Search')),
+ array('db_operations.php', __('Operations')),
+ );
+ }
+
+ /**
+ * @dataProvider dataProvider
+ * @return void
+ */
+ function testGetTitleForTarget($target, $result){
+
+ $this->assertEquals($result,PMA_getTitleForTarget($target));
+ }
+
+}
+
+//PMA_getTitleForTarget
\ No newline at end of file
diff --git a/test/libraries/common/PMA_localisedDateTimespan_test.php b/test/libraries/common/PMA_localisedDateTimespan_test.php
new file mode 100644
index 0000000..7ec0364
--- /dev/null
+++ b/test/libraries/common/PMA_localisedDateTimespan_test.php
@@ -0,0 +1,94 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for generating localised date or timespan expression
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_localisedDateTimespan_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_localisedDateTimespan_test extends PHPUnit_Framework_TestCase
+{
+ /**
+ * temporary variable for globals array
+ */
+ protected $tmpGlobals;
+
+ /**
+ * temporary variable for session array
+ */
+ protected $tmpSession;
+
+ /**
+ * temporary variable for timezone info
+ */
+ protected $tmpTimezone;
+
+ /**
+ * storing globals and session
+ */
+ public function setUp() {
+
+ $this->tmpGlobals = $GLOBALS;
+ $this->tmpSession = $_SESSION;
+ $this->tmpTimezone = date_default_timezone_get();
+ date_default_timezone_set('Europe/London');
+ }
+
+ /**
+ * recovering globals and session
+ */
+ public function tearDown() {
+
+ $GLOBALS = $this->tmpGlobals;
+ $_SESSION = $this->tmpSession;
+ date_default_timezone_set($this->tmpTimezone);
+
+ }
+
+ /**
+ * data provider for localised date test
+ */
+ public function localisedDateDataProvider() {
+ return array(
+ array(1227455558, '', 'Nov 23, 2008 at 03:52 PM'),
+ array(1227455558, '%Y-%m-%d %H:%M:%S %a', '2008-11-23 15:52:38 Sun')
+ );
+ }
+
+ /**
+ * localised date test, globals are defined
+ * @dataProvider localisedDateDataProvider
+ */
+ public function testLocalisedDate($a, $b, $e) {
+ $this->assertEquals($e, PMA_localisedDate($a, $b));
+ }
+
+ /**
+ * data provider for localised timestamp test
+ */
+
+ public function timespanFormatDataProvider() {
+ return array(
+ array(1258, '0 days, 0 hours, 20 minutes and 58 seconds'),
+ array(821958, '9 days, 12 hours, 19 minutes and 18 seconds')
+ );
+ }
+
+ /**
+ * localised timestamp test, globals are defined
+ * @dataProvider timespanFormatDataProvider
+ */
+ public function testTimespanFormat($a, $e) {
+ $GLOBALS['timespanfmt'] = '%s days, %s hours, %s minutes and %s seconds';
+
+ $this->assertEquals($e, PMA_timespanFormat($a));
+ }
+}
+?>
diff --git a/test/libraries/common/PMA_pow_test.php b/test/libraries/common/PMA_pow_test.php
new file mode 100644
index 0000000..ff55e16
--- /dev/null
+++ b/test/libraries/common/PMA_pow_test.php
@@ -0,0 +1,80 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Tests for PMA_pow() function from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_pow_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_pow_test extends PHPUnit_Framework_TestCase
+{
+ public function testIntOverflow()
+ {
+ $this->assertEquals('1267650600228229401496703205376',
+ PMA_pow(2, 100));
+ }
+
+ public function testBcpow()
+ {
+ if (function_exists('bcpow')) {
+ $this->assertEquals('1267650600228229401496703205376',
+ PMA_pow(2, 100, 'bcpow'));
+ } else {
+ $this->markTestSkipped('function bcpow() does not exist');
+ }
+ }
+
+ public function testGmppow()
+ {
+ if (function_exists('gmp_pow')) {
+ $this->assertEquals('1267650600228229401496703205376',
+ PMA_pow(2, 100, 'gmp_pow'));
+ } else {
+ $this->markTestSkipped('function gmp_pow() does not exist');
+ }
+ }
+
+ public function _testNegativeExp()
+ {
+ $this->assertEquals(0.25,
+ PMA_pow(2, -2));
+ }
+
+ public function _testNegativeExpPow()
+ {
+ if (function_exists('pow')) {
+ $this->assertEquals(0.25,
+ PMA_pow(2, -2, 'pow'));
+ } else {
+ $this->markTestSkipped('function pow() does not exist');
+ }
+ }
+
+ public function _testNegativeExpBcpow()
+ {
+ if (function_exists('bcpow')) {
+ $this->assertEquals(0.25,
+ PMA_pow(2, -2, 'bcpow'));
+ } else {
+ $this->markTestSkipped('function bcpow() does not exist');
+ }
+ }
+
+ public function _testNegativeExpGmppow()
+ {
+ if (function_exists('gmp_pow')) {
+ $this->assertEquals(0.25,
+ PMA_pow(2, -2, 'gmp_pow'));
+ } else {
+ $this->markTestSkipped('function gmp_pow() does not exist');
+ }
+ }
+}
+?>
diff --git a/test/libraries/common/PMA_printableBitValue_test.php b/test/libraries/common/PMA_printableBitValue_test.php
new file mode 100644
index 0000000..d211981
--- /dev/null
+++ b/test/libraries/common/PMA_printableBitValue_test.php
@@ -0,0 +1,39 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test printableBitValue function
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_printableBitValue_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_printableBitValue_test extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ * data provider for printable bit value test
+ */
+
+ public function printableBitValueDataProvider() {
+ return array(
+ array('testtest', 64, '0111010001100101011100110111010001110100011001010111001101110100'),
+ array('test', 32, '01110100011001010111001101110100')
+ );
+ }
+
+ /**
+ * test for generating string contains printable bit value of selected data
+ * @dataProvider printableBitValueDataProvider
+ */
+
+ public function testPrintableBitValue($a, $b, $e) {
+ $this->assertEquals($e, PMA_printable_bit_value($a, $b));
+ }
+}
+?>
diff --git a/test/libraries/common/PMA_quoting_slashing_test.php b/test/libraries/common/PMA_quoting_slashing_test.php
new file mode 100644
index 0000000..4ebecc0
--- /dev/null
+++ b/test/libraries/common/PMA_quoting_slashing_test.php
@@ -0,0 +1,108 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for quoting, slashing/backslashing
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_quoting_slashing_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+require_once 'libraries/sqlparser.data.php';
+
+class PMA_quoting_slashing_test extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ * sqlAddslashes test
+ */
+ public function testAddSlashes() {
+ $string = "\'test''\''\'\r\t\n";
+
+ $this->assertEquals("\\\\\\\\\'test\'\'\\\\\\\\\'\'\\\\\\\\\'\\r\\t\\n", PMA_sqlAddSlashes($string, true, true, true));
+ $this->assertEquals("\\\\\\\\''test''''\\\\\\\\''''\\\\\\\\''\\r\\t\\n", PMA_sqlAddSlashes($string, true, true, false));
+ $this->assertEquals("\\\\\\\\\'test\'\'\\\\\\\\\'\'\\\\\\\\\'\r\t\n", PMA_sqlAddSlashes($string, true, false, true));
+ $this->assertEquals("\\\\\\\\''test''''\\\\\\\\''''\\\\\\\\''\r\t\n", PMA_sqlAddSlashes($string, true, false, false));
+ $this->assertEquals("\\\\\'test\'\'\\\\\'\'\\\\\'\\r\\t\\n", PMA_sqlAddSlashes($string, false, true, true));
+ $this->assertEquals("\\\\''test''''\\\\''''\\\\''\\r\\t\\n", PMA_sqlAddSlashes($string, false, true, false));
+ $this->assertEquals("\\\\\'test\'\'\\\\\'\'\\\\\'\r\t\n", PMA_sqlAddSlashes($string, false, false, true));
+ $this->assertEquals("\\\\''test''''\\\\''''\\\\''\r\t\n", PMA_sqlAddSlashes($string, false, false, false));
+ }
+
+ /**
+ * data provider for unQuote test
+ */
+ public function unQuoteProvider() {
+ return array(
+ array('"test\'"', "test'"),
+ array("'test''", "test'"),
+ array("`test'`", "test'"),
+ array("'test'test", "'test'test")
+ );
+ }
+
+ /**
+ * unQuote test
+ * @dataProvider unQuoteProvider
+ */
+ public function testUnQuote($param, $expected) {
+ $this->assertEquals($expected, PMA_unQuote($param));
+ }
+
+ /**
+ * data provider for unQuote test with chosen quote
+ */
+ public function unQuoteSelectedProvider() {
+ return array(
+ array('"test\'"', "test'"),
+ array("'test''", "'test''"),
+ array("`test'`", "`test'`"),
+ array("'test'test", "'test'test")
+ );
+ }
+
+ /**
+ * unQuote test with chosen quote
+ * @dataProvider unQuoteSelectedProvider
+ */
+ public function testUnQuoteSelectedChar($param, $expected) {
+ $this->assertEquals($expected, PMA_unQuote($param, '"'));
+ }
+
+ /**
+ * data provider for backquote test
+ */
+ public function backquoteDataProvider() {
+ return array(
+ array('0', '`0`'),
+ array('test', '`test`'),
+ array('te`st', '`te``st`'),
+ array(array('test', 'te`st', '', '*'), array('`test`', '`te``st`', '', '*'))
+ );
+ }
+
+ /**
+ * backquote test with different param $do_it (true, false)
+ * @dataProvider backquoteDataProvider
+ */
+ public function testBackquote($a, $b) {
+ // Test bypass quoting (used by dump functions)
+ $this->assertEquals($a, PMA_backquote($a, false));
+
+ // Test backquote
+ $this->assertEquals($b, PMA_backquote($a));
+ }
+
+ public function testBackquoteForbidenWords() {
+ global $PMA_SQPdata_forbidden_word;
+
+ foreach ($PMA_SQPdata_forbidden_word as $forbidden){
+ $this->assertEquals("`" . $forbidden . "`", PMA_backquote($forbidden, false));
+ }
+ }
+}
+?>
diff --git a/test/libraries/common/PMA_showDocu_test.php b/test/libraries/common/PMA_showDocu_test.php
new file mode 100644
index 0000000..b287ea1
--- /dev/null
+++ b/test/libraries/common/PMA_showDocu_test.php
@@ -0,0 +1,39 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_showDocu from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_showDocu.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_showDocu_test extends PHPUnit_Framework_TestCase
+{
+ function testShowDocuReplaceHelpImg()
+ {
+ $GLOBALS['cfg']['ReplaceHelpImg'] = true;
+
+ $anchor = "relation";
+ $expected = '<a href="Documentation.html#' . $anchor . '" target="documentation"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png" width="11" height="11" alt="' . __('Documentation') . '" title="' . __('Documentation') . '" /></a>';
+
+ $this->assertEquals($expected, PMA_showDocu($anchor));
+
+ }
+
+ function testShowDocuNotReplaceHelpImg()
+ {
+ $GLOBALS['cfg']['ReplaceHelpImg'] = false;
+
+ $anchor = "relation";
+ $expected = '[<a href="Documentation.html#' . $anchor . '" target="documentation">' . __('Documentation') . '</a>]';
+
+ $this->assertEquals($expected, PMA_showDocu($anchor));
+
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_showMessage_test_disabled.php b/test/libraries/common/PMA_showMessage_test_disabled.php
new file mode 100644
index 0000000..d89aa10
--- /dev/null
+++ b/test/libraries/common/PMA_showMessage_test_disabled.php
@@ -0,0 +1,67 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_showMessage from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_showMessage_test.php
+ * @group common.lib-tests
+ */
+
+const PMA_IS_WINDOWS = false;
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+require_once 'libraries/Table.class.php';
+require_once 'libraries/database_interface.lib.php';
+require_once 'libraries/js_escape.lib.php';
+
+class PMA_showMessage_test extends PHPUnit_Extensions_OutputTestCase
+{
+ function setUp()
+ {
+ global $cfg;
+ require 'libraries/config.default.php';
+ }
+
+ function testShowMessageNotAjax()
+ {
+ global $cfg;
+
+ $GLOBALS['is_ajax_request'] = true;
+ $cfg['Server']['DisableIS'] = false;
+ $GLOBALS['table'] = 'tbl';
+ $GLOBALS['db'] = 'db';
+
+ $_SESSION[' PMA_token '] = md5(uniqid(rand(), true));
+
+ $GLOBALS['sql_query'] = "SELECT * FROM tblPatient ";
+
+ $this->expectOutputString("<script type=\"text/javascript\">
+ //<![CDATA[
+ if (window.parent.updateTableTitle) window.parent.updateTableTitle('db.tbl', ' ()');
+ //]]>
+ </script>
+ <div id=\"result_query\" align=\"\">
+ <div class=\"notice\">msg</div><code class=\"sql\"><span class=\"syntax\"><span class=\"inner_sql\"><a href=\"./url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.0%2Fen%2Fselect.html&server=server&lang=en&token=647a62ad301bf9025e3b13bc7caa02cb\" target=\"mysql_doc\"><span class=\"syntax_alpha syntax_alpha_reservedWord\">SELECT</span></a> <span class=\"syntax_punct\">*</span> <br /><span class=\"syntax_alpha syntax_alpha_reservedWord\">FROM</span> <span class=\"syntax_alpha syntax_alpha_identifier\">tblPatient</span></span></span></code><div class=\"tools\"><form action=\"sql.php\" method=\"post\"><input type=\"hidden\" name=\"db\" value=\"db\" /><input type=\"hidden\" name=\"table\" value=\"tbl\" /><input type=\"hidden\" name=\"server\" value=\"server\" /><input type=\"hidden\" name=\"lang\" value=\"en\" /><input type=\"hidden\" name=\"token\" value=\"647a62ad301bf9025e3b13bc7caa02cb\" /><input type=\"hidden\" name=\"sql_query\" value=\"SELECT * FROM tblPatient \" /></form><script type=\"text/javascript\">
+ //<![CDATA[
+ $('.tools form').last().after('[<a href=\"#\" title=\"Inline edit of this query\" class=\"inline_edit_sql\">Inline</a>]');
+ //]]>
+ </script> [
+ <a href=\"tbl_sql.php?db=db&table=tbl&sql_query=SELECT+%2A+FROM+tblPatient+&show_query=1&server=server&lang=en&token=647a62ad301bf9025e3b13bc7caa02cb#querybox\" onclick=\"window.parent.focus_querywindow('SELECT * FROM tblPatient '); return false;\">Edit</a>
+ ] [
+ <a href=\"import.php?db=db&table=tbl&sql_query=EXPLAIN+SELECT+%2A+FROM+tblPatient+&server=server&lang=en&token=647a62ad301bf9025e3b13bc7caa02cb\" >Explain SQL</a>
+ ] [
+ <a href=\"import.php?db=db&table=tbl&sql_query=SELECT+%2A+FROM+tblPatient+&show_query=1&show_as_php=1&server=server&lang=en&token=647a62ad301bf9025e3b13bc7caa02cb\" >Create PHP Code</a>
+ ] [
+ <a href=\"import.php?db=db&table=tbl&sql_query=SELECT+%2A+FROM+tblPatient+&show_query=1&server=server&lang=en&token=647a62ad301bf9025e3b13bc7caa02cb\" >Refresh</a>
+ ]</div></div>");
+
+ echo PMA_showMessage("msg");
+
+ //$this->assertEquals("",PMA_showMessage("msg"));
+ $this->assertTrue(true);
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_showPHPDocu_test.php b/test/libraries/common/PMA_showPHPDocu_test.php
new file mode 100644
index 0000000..eb98f30
--- /dev/null
+++ b/test/libraries/common/PMA_showPHPDocu_test.php
@@ -0,0 +1,42 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_showPHPDocu from common.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_showPHPDocu_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_showPHPDocu_test extends PHPUnit_Framework_TestCase
+{
+ function testShwoPHPDocuReplaceHelpImg()
+ {
+ $GLOBALS['cfg']['ReplaceHelpImg'] = true;
+
+ $target = "docu";
+ $lang = _pgettext('PHP documentation language', 'en');
+ $expected = '<a href="http://php.net/manual/' . $lang . '/' . $target . '" target="documentation"><img class="icon" src="'
+ . $GLOBALS['pmaThemeImage'] . 'b_help.png" width="11" height="11" alt="' . __('Documentation') . '" title="' . __('Documentation') . '" /></a>';
+
+ $this->assertEquals($expected, PMA_showPHPDocu($target));
+ }
+
+ function testShwoPHPDocuNotReplaceHelpImg()
+ {
+ $GLOBALS['cfg']['ReplaceHelpImg'] = false;
+
+ $target = "docu";
+ $lang = _pgettext('PHP documentation language', 'en');
+ $expected = '[<a href="http://php.net/manual/' . $lang . '/' . $target . '" target="documentation">' . __('Documentation') . '</a>]';
+
+ $this->assertEquals($expected, PMA_showPHPDocu($target));
+ }
+
+
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_stringOperations_test.php b/test/libraries/common/PMA_stringOperations_test.php
new file mode 100644
index 0000000..f57a2b4
--- /dev/null
+++ b/test/libraries/common/PMA_stringOperations_test.php
@@ -0,0 +1,128 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for several string operations
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_stringOperations_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_stringOperations_test extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ * temporary variable for globals array
+ */
+
+ protected $tmpGlobals;
+
+ /**
+ * temporary variable for session array
+ */
+
+ protected $tmpSession;
+
+ /**
+ * storing globals and session
+ */
+ public function setUp() {
+
+ global $GLOBALS, $_SESSION;
+ $this->tmpGlobals = $GLOBALS;
+ $this->tmpSession = $_SESSION;
+
+ }
+
+ /**
+ * data provider for flipstring test
+ */
+
+ public function flipStringDataProvider() {
+ return array(
+ array('test', "t<br />\ne<br />\ns<br />\nt"),
+ array('te ;st', "t<br />\ne<br />\n <br />\n;<br />\ns<br />\nt")
+ );
+ }
+
+ /**
+ * test of changing string from horizontal to vertical orientation
+ * @dataProvider flipStringDataProvider
+ */
+
+ public function testFlipString($a, $e) {
+ $this->assertEquals($e, PMA_flipstring($a));
+ }
+
+ /**
+ * data provider for userDir test
+ */
+
+ public function userDirDataProvider() {
+ return array(
+ array('/var/pma_tmp/%u/', "/var/pma_tmp/root/"),
+ array('/home/%u/pma', "/home/root/pma/")
+ );
+ }
+
+ /**
+ * test of generating user dir, globals are defined
+ * @dataProvider userDirDataProvider
+ */
+
+ public function testUserDirString($a, $e) {
+ $GLOBALS['cfg']['Server']['user'] = 'root';
+
+ $this->assertEquals($e, PMA_userDir($a));
+ }
+
+ /**
+ * data provider for replace binary content test
+ */
+
+ public function replaceBinaryContentsDataProvider() {
+ return array(
+ array("\x000", '\00'),
+ array("\x08\x0a\x0d\x1atest", '\b\n\r\Ztest'),
+ array("\ntest", '\ntest')
+ );
+ }
+
+ /**
+ * replace binary contents test
+ * @dataProvider replaceBinaryContentsDataProvider
+ */
+
+ public function testReplaceBinaryContents($a, $e) {
+ $this->assertEquals($e, PMA_replace_binary_contents($a));
+ }
+
+ /**
+ * data provider for duplicate first newline test
+ */
+
+ public function duplicateFirstNewlineDataProvider() {
+ return array(
+ array('test', 'test'),
+ array("\r\ntest", "\n\r\ntest"),
+ array("\ntest", "\ntest"),
+ array("\n\r\ntest", "\n\r\ntest")
+ );
+ }
+
+ /**
+ * duplicate first newline test
+ * @dataProvider duplicateFirstNewlineDataProvider
+ */
+
+ public function testDuplicateFirstNewline($a, $e) {
+ $this->assertEquals($e, PMA_duplicateFirstNewline($a));
+ }
+
+}
+?>
diff --git a/test/libraries/common/PMA_unsupportedDatatypes_test.php b/test/libraries/common/PMA_unsupportedDatatypes_test.php
new file mode 100644
index 0000000..686e4ee
--- /dev/null
+++ b/test/libraries/common/PMA_unsupportedDatatypes_test.php
@@ -0,0 +1,32 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_unsupportedDatatypes from common.lib
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_unsupportedDatatypes_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_unsupportedDatatypes_test extends PHPUnit_Framework_TestCase
+{
+
+ function testNotSupportedDataTypes()
+ {
+ $no_support_types = array('geometry',
+ 'point',
+ 'linestring',
+ 'polygon',
+ 'multipoint',
+ 'multilinestring',
+ 'multipolygon',
+ 'geometrycollection'
+ );
+ $this->assertEquals($no_support_types, PMA_unsupportedDatatypes());
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/common/PMA_whichCrlf_test.php b/test/libraries/common/PMA_whichCrlf_test.php
new file mode 100644
index 0000000..52d8323
--- /dev/null
+++ b/test/libraries/common/PMA_whichCrlf_test.php
@@ -0,0 +1,63 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test whichCrlf function
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_whichCrlf_test.php
+ * @group common.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+
+class PMA_whichCrlf_test extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ * @using runkit pecl extension
+ * if not define PMA_USR_OS, then define it as Win
+ * if installed runkit, then constant will not change
+ */
+ public function testWhichCrlf()
+ {
+ $runkit = function_exists('runkit_constant_redefine');
+ if ($runkit && defined('PMA_USR_OS'))
+ $pma_usr_os = PMA_USR_OS;
+
+ if (defined('PMA_USR_OS') && !$runkit) {
+
+ if (PMA_USR_OS == 'Win')
+ $this->assertEquals("\r\n", PMA_whichCrlf());
+ else
+ $this->assertEquals("\n", PMA_whichCrlf());
+
+ $this->markTestIncomplete('Cannot redefine constant');
+
+ } else {
+
+ if ($runkit) {
+ define('PMA_USR_OS', 'Linux');
+ $this->assertEquals("\n", PMA_whichCrlf());
+ }
+
+ if ($runkit)
+ runkit_constant_redefine('PMA_USR_OS', 'Win');
+ else
+ define('PMA_USR_OS', 'Win');
+ $this->assertEquals("\r\n", PMA_whichCrlf());
+
+ }
+
+ if ($runkit) {
+ if (isset($pma_usr_os))
+ runkit_constant_redefine('PMA_USR_OS', 'Win');
+ else
+ runkit_constant_remove('PMA_USR_OS');
+ }
+ }
+
+}
+?>
diff --git a/test/libraries/core/PMA_array_test.php b/test/libraries/core/PMA_array_test.php
new file mode 100644
index 0000000..aae8332
--- /dev/null
+++ b/test/libraries/core/PMA_array_test.php
@@ -0,0 +1,231 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_array_read(), PMA_array_write(), PMA_array_remove(), PMA_array_merge_recursive(),
+ * PMA_arrayWalkRecursive() from libraries/core.lib.php
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/core.lib.php';
+
+class PMA_array_test extends PHPUnit_Framework_TestCase
+{
+ function testPMA_array_read()
+ {
+ $arr = array(
+ "int" => 1,
+ "str" => "str_val",
+ "arr" => array('val1', 'val2', 'val3'),
+ "sarr" => array('arr1' => array(1, 2, 3), array(3, array('a', 'b', 'c'), 4))
+ );
+
+ $this->assertEquals(PMA_array_read('int', $arr), $arr['int']);
+
+ $this->assertEquals(PMA_array_read('str', $arr), $arr['str']);
+
+ $this->assertEquals(PMA_array_read('arr/0', $arr), $arr['arr'][0]);
+
+ $this->assertEquals(PMA_array_read('arr/1', $arr), $arr['arr'][1]);
+
+ $this->assertEquals(PMA_array_read('arr/2', $arr), $arr['arr'][2]);
+
+ $this->assertEquals(PMA_array_read('sarr/arr1/0', $arr), $arr['sarr']['arr1'][0]);
+
+ $this->assertEquals(PMA_array_read('sarr/arr1/1', $arr), $arr['sarr']['arr1'][1]);
+
+ $this->assertEquals(PMA_array_read('sarr/arr1/2', $arr), $arr['sarr']['arr1'][2]);
+
+ $this->assertEquals(PMA_array_read('sarr/0/0', $arr), $arr['sarr'][0][0]);
+
+ $this->assertEquals(PMA_array_read('sarr/0/1', $arr), $arr['sarr'][0][1]);
+
+ $this->assertEquals(PMA_array_read('sarr/0/1/2', $arr), $arr['sarr'][0][1][2]);
+
+ $this->assertEquals(PMA_array_read('sarr/not_exiting/1', $arr), null);
+
+ $this->assertEquals(PMA_array_read('sarr/not_exiting/1', $arr, 0), 0);
+
+ $this->assertEquals(PMA_array_read('sarr/not_exiting/1', $arr, 'defailt_val'), 'defailt_val');
+ }
+
+ function testPMA_array_write()
+ {
+ $arr = array(
+ "int" => 1,
+ "str" => "str_val",
+ "arr" => array('val1', 'val2', 'val3'),
+ "sarr" => array('arr1' => array(1, 2, 3), array(3, array('a', 'b', 'c'), 4))
+ );
+
+ PMA_array_write('int', $arr, 5);
+ $this->assertEquals($arr['int'], 5);
+
+ PMA_array_write('str', $arr, '_str');
+ $this->assertEquals($arr['str'], '_str');
+
+ PMA_array_write('arr/0', $arr, 'val_arr_0');
+ $this->assertEquals($arr['arr'][0], 'val_arr_0');
+
+ PMA_array_write('arr/1', $arr, 'val_arr_1');
+ $this->assertEquals($arr['arr'][1], 'val_arr_1');
+
+ PMA_array_write('arr/2', $arr, 'val_arr_2');
+ $this->assertEquals($arr['arr'][2], 'val_arr_2');
+
+ PMA_array_write('sarr/arr1/0', $arr, 'val_sarr_arr_0');
+ $this->assertEquals($arr['sarr']['arr1'][0], 'val_sarr_arr_0');
+
+ PMA_array_write('sarr/arr1/1', $arr, 'val_sarr_arr_1');
+ $this->assertEquals($arr['sarr']['arr1'][1], 'val_sarr_arr_1');
+
+ PMA_array_write('sarr/arr1/2', $arr, 'val_sarr_arr_2');
+ $this->assertEquals($arr['sarr']['arr1'][2], 'val_sarr_arr_2');
+
+ PMA_array_write('sarr/0/0', $arr, 5);
+ $this->assertEquals($arr['sarr'][0][0], 5);
+
+ PMA_array_write('sarr/0/1/0', $arr, 'e');
+ $this->assertEquals($arr['sarr'][0][1][0], 'e');
+
+ PMA_array_write('sarr/not_existing/1', $arr, 'some_val');
+ $this->assertEquals($arr['sarr']['not_existing'][1], 'some_val');
+
+ PMA_array_write('sarr/0/2', $arr, NULL);
+ $this->assertNull($arr['sarr'][0][2]);
+ }
+
+ function testPMA_array_remove()
+ {
+ $arr = array(
+ "int" => 1,
+ "str" => "str_val",
+ "arr" => array('val1', 'val2', 'val3'),
+ "sarr" => array('arr1' => array(1, 2, 3), array(3, array('a', 'b', 'c'), 4))
+ );
+
+ PMA_array_remove('int', $arr);
+ $this->assertArrayNotHasKey('int', $arr);
+
+ PMA_array_remove('str', $arr);
+ $this->assertArrayNotHasKey('str', $arr);
+
+ PMA_array_remove('arr/0', $arr);
+ $this->assertArrayNotHasKey(0, $arr['arr']);
+
+ PMA_array_remove('arr/1', $arr);
+ $this->assertArrayNotHasKey(1, $arr['arr']);
+
+ PMA_array_remove('arr/2', $arr);
+ $this->assertArrayNotHasKey('arr', $arr);
+
+ $tmp_arr = $arr;
+ PMA_array_remove('sarr/not_existing/1', $arr);
+ $this->assertEquals($tmp_arr, $arr);
+
+ PMA_array_remove('sarr/arr1/0', $arr);
+ $this->assertArrayNotHasKey(0, $arr['sarr']['arr1']);
+
+ PMA_array_remove('sarr/arr1/1', $arr);
+ $this->assertArrayNotHasKey(1, $arr['sarr']['arr1']);
+
+ PMA_array_remove('sarr/arr1/2', $arr);
+ $this->assertArrayNotHasKey('arr1', $arr['sarr']);
+
+ PMA_array_remove('sarr/0/0', $arr);
+ $this->assertArrayNotHasKey(0, $arr['sarr'][0]);
+
+ PMA_array_remove('sarr/0/1/0', $arr);
+ $this->assertArrayNotHasKey(0, $arr['sarr'][0][1]);
+
+ PMA_array_remove('sarr/0/1/1', $arr);
+ $this->assertArrayNotHasKey(1, $arr['sarr'][0][1]);
+
+ PMA_array_remove('sarr/0/1/2', $arr);
+ $this->assertArrayNotHasKey(1, $arr['sarr'][0]);
+
+ PMA_array_remove('sarr/0/2', $arr);
+
+ $this->assertEmpty($arr);
+ }
+
+ function testPMA_array_merge_recursive()
+ {
+ $arr1 = array('key1' => 1, 'key2' => 2.3, 'key3' => 'str3');
+ $arr2 = array('key1' => 4, 'key2' => 5, 'key3' => 6);
+ $arr3 = array('key4' => 7, 'key5' => 'str8', 'key6' => 9);
+ $arr4 = array(1, 2, 3);
+
+ $this->assertFalse(PMA_array_merge_recursive());
+
+ $this->assertEquals(PMA_array_merge_recursive($arr1), $arr1);
+
+ $this->assertEquals(PMA_array_merge_recursive($arr1, 'str'), 'str');
+
+ $this->assertEquals(PMA_array_merge_recursive('str1', $arr2), $arr2);
+
+ $this->assertEquals(PMA_array_merge_recursive($arr1, $arr2), array('key1' => 4, 'key2' => 5, 'key3' => 6));
+
+ $this->assertEquals(PMA_array_merge_recursive($arr1, $arr3), array('key1' => 1, 'key2' => 2.3, 'key3' => 'str3', 'key4' => 7, 'key5' => 'str8', 'key6' => 9));
+
+ $this->assertEquals(PMA_array_merge_recursive($arr2, $arr4), array(1, 2, 3));
+
+ $this->assertEquals(PMA_array_merge_recursive($arr1, $arr2, $arr3), array('key1' => 4, 'key2' => 5, 'key3' => 6, 'key4' => 7, 'key5' => 'str8', 'key6' => 9));
+ }
+
+
+ function testPMA_arrayWalkRecursive()
+ {
+ function fConcat($var)
+ {
+ return 'val: ' . $var . ' processed';
+ }
+
+ $arr = array(1, 2, 3, 4);
+ $target = array('val: 1 processed','val: 2 processed','val: 3 processed','val: 4 processed');
+
+ PMA_arrayWalkRecursive($arr, 'fConcat');
+ $this->assertEquals($arr, $target);
+ }
+
+ /**
+ * @depends testPMA_arrayWalkRecursive
+ */
+ function testPMA_arrayWalkRecursiveNotProcessIntKeys()
+ {
+ function fAdd($var)
+ {
+ return ++$var;
+ }
+
+ $arr = array(1, 2, 3, 4);
+ $target = array(2, 3, 4, 5);
+
+ PMA_arrayWalkRecursive($arr, 'fAdd', true);
+ $this->assertEquals($arr, $target);
+ }
+
+ /**
+ * @depends testPMA_arrayWalkRecursiveNotProcessIntKeys
+ */
+ function testPMA_arrayWalkRecursiveSubArray()
+ {
+ $arr = array("key1"=>'val1', 'key2'=>array('skey1'=>'sval1','skey2'=>'sval2'),'key3'=>'val3');
+ $target = array('key1'=>'val: val1 processed', 'key2'=> array('skey1'=>'val: sval1 processed', 'skey2'=>'val: sval2 processed'),'key3'=>'val: val3 processed');
+
+ PMA_arrayWalkRecursive($arr, 'fConcat');
+ $this->assertEquals($arr, $target);
+ }
+
+ function testPMA_arrayWalkRecursiveApplyToKeysStripSlashes()
+ {
+ $arr = array("key\\1"=>'v\\\\al1', 'k\\ey2'=>array('s\\\\key1'=>'sval\\1','s\\k\\ey2'=>'s\\v\\al2'),'key3'=>'val3');
+ $target = array("key1"=>'val1', 'key2'=>array('skey1'=>'sval1','skey2'=>'sval2'),'key3'=>'val3');
+
+ PMA_arrayWalkRecursive($arr, 'stripslashes',true);
+ $this->assertEquals($arr, $target);
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/core/PMA_checkPageValidity_test.php b/test/libraries/core/PMA_checkPageValidity_test.php
new file mode 100644
index 0000000..ebc174d
--- /dev/null
+++ b/test/libraries/core/PMA_checkPageValidity_test.php
@@ -0,0 +1,66 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Tests for PMA_checkPageValidity() from libraries/core.lib.php
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/core.lib.php';
+
+class PMA_checkPageValidity_test extends PHPUnit_Framework_TestCase{
+ protected $goto_whitelist = array(
+ 'db_create.php',
+ 'db_datadict.php',
+ 'db_sql.php',
+ 'db_export.php',
+ 'db_search.php',
+ 'export.php',
+ 'import.php',
+ 'main.php',
+ 'pdf_pages.php',
+ 'pdf_schema.php',
+ 'querywindow.php',
+ 'server_binlog.php',
+ 'server_variables.php',
+ 'sql.php',
+ 'tbl_alter.php',
+ 'tbl_select.php',
+ 'transformation_overview.php',
+ 'transformation_wrapper.php',
+ 'user_password.php',
+ );
+
+ function testGotoNowhere(){
+ $page = null;
+ $this->assertFalse(PMA_checkPageValidity($page,null));
+ }
+
+ function testGotoWhitelist(){
+ $page = 'export.php';
+
+ $this->assertTrue(PMA_checkPageValidity($page,$this->goto_whitelist));
+ }
+
+ function testGotoNotInWhitelist(){
+ $page = 'shell.php';
+
+ $this->assertFalse(PMA_checkPageValidity($page,$this->goto_whitelist));
+ }
+
+ function testGotoWhitelistPage(){
+ $page = 'main.php?sql.php&test=true';
+
+ $this->assertTrue(PMA_checkPageValidity($page,$this->goto_whitelist));
+ }
+
+ function testGotoWhitelistEncodedPage(){
+ $page = 'main.php%3Fsql.php%26test%3Dtrue';
+
+ $this->assertTrue(PMA_checkPageValidity($page,$this->goto_whitelist));
+ }
+
+}
\ No newline at end of file
diff --git a/test/libraries/core/PMA_fatalError_test.php b/test/libraries/core/PMA_fatalError_test.php
new file mode 100644
index 0000000..643c4d9
--- /dev/null
+++ b/test/libraries/core/PMA_fatalError_test.php
@@ -0,0 +1,43 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_fatalError() from libraries/core.lib.php
+ *
+ * PMA_fatalError() displays the given error message on phpMyAdmin error page in foreign language
+ * and ends script execution and closes session
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/select_lang.lib.php';
+require_once 'libraries/core.lib.php';
+require_once 'libraries/sanitizing.lib.php';
+require_once 'libraries/Config.class.php';
+
+class PMA_fatalError_test extends PHPUnit_Extensions_OutputTestCase
+{
+ public function testFatalErrorMessage()
+ {
+ $this->expectOutputRegex("/FatalError!/");
+ PMA_fatalError("FatalError!");
+ }
+
+ public function testFatalErrorMessageWithArgs()
+ {
+ $message = "Fatal error #%d in file %s.";
+ $params = array(1, 'error_file.php');
+
+ $this->expectOutputRegex("/Fatal error #1 in file error_file.php./", "Not EQ");
+ PMA_fatalError($message, $params);
+
+ $message = "Fatal error in file %s.";
+ $params = 'error_file.php';
+
+ $this->expectOutputRegex("/Fatal error in file error_file.php./");
+ PMA_fatalError($message, $params);
+ }
+
+}
\ No newline at end of file
diff --git a/test/libraries/core/PMA_getLinks_test.php b/test/libraries/core/PMA_getLinks_test.php
new file mode 100644
index 0000000..59aac3e
--- /dev/null
+++ b/test/libraries/core/PMA_getLinks_test.php
@@ -0,0 +1,59 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_getPHPDocLink, PMA_linkURL, PMA_includeJS from libraries/core.lib.php
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/core.lib.php';
+require_once 'libraries/url_generating.lib.php';
+
+class PMA_getLinks_test extends PHPUnit_Framework_TestCase
+{
+ public function testPMA_getPHPDocLink()
+ {
+ $lang = _pgettext('PHP documentation language', 'en');
+ $this->assertEquals(PMA_getPHPDocLink('function'), 'http://php.net/manual/' . $lang . '/function');
+ }
+
+ public function providerLinkURL(){
+ return array(
+ array('http://wiki.phpmyadmin.net', './url.php?url=http%3A%2F%2Fwiki.phpmyadmin.net&lang=en'),
+ array('https://wiki.phpmyadmin.net', './url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net&lang=en'),
+ array('wiki.phpmyadmin.net', 'wiki.phpmyadmin.net'),
+ array('index.php?db=phpmyadmin', 'index.php?db=phpmyadmin')
+ );
+ }
+
+ /**
+ * @dataProvider providerLinkURL
+ */
+ public function testPMA_linkURL($link, $url){
+ $this->assertEquals(PMA_linkURL($link), $url);
+ }
+
+ public function testPMA_includeJS()
+ {
+ $filename = "common.js";
+ $mod = 0;
+
+ if (file_exists('./js/'.$filename)) {
+ $mod = filemtime('./js/'.$filename);
+ }
+ else{
+ $this->fail("JS file doesn't exists.");
+ }
+ $this->assertEquals(PMA_includeJS($filename), '<script src="./js/'.$filename.'?ts='.$mod.'" type="text/javascript"></script>'. "\n");
+
+ $filename = '?file.js';
+ //$this->assertEquals(PMA_includeJS($filename), '<script src="./js/?file.js" type="text/javascript"></script>\n');
+ $this->assertEquals(PMA_includeJS($filename), '<script src="./js/'.$filename.'" type="text/javascript"></script>'."\n");
+
+ //$this->assertFalse(PMA_includeJS(null));
+ }
+
+}
diff --git a/test/libraries/core/PMA_getTableCount_test_dis.php b/test/libraries/core/PMA_getTableCount_test_dis.php
new file mode 100644
index 0000000..7910377
--- /dev/null
+++ b/test/libraries/core/PMA_getTableCount_test_dis.php
@@ -0,0 +1,37 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_getTableCount_test from core.lib.php
+ * PMA_getTableCount_test returns count of tables in given db
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/core.lib.php';
+require_once 'libraries/common.lib.php';
+require_once 'libraries/config.default.php';
+require_once 'libraries/Config.class.php';
+require_once 'libraries/database_interface.lib.php';
+
+require_once 'config.sample.inc.php';
+
+class PMA_getTableCount_test extends PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ $GLOBALS['PMA_Config'] = new PMA_Config();
+ }
+
+ function testTableCount()
+ {
+ $GLOBALS['cfg']['Server']['extension'] = 'mysql';
+ $GLOBALS['cfg']['Server']['host'] = 'localhost';
+ $GLOBALS['cfg']['Server']['user'] = 'root';
+
+ $this->assertEquals(5,PMA_getTableCount('meddb'));
+ $this->assertTrue(true);
+ }
+}
diff --git a/test/libraries/core/PMA_get_real_size_test.php b/test/libraries/core/PMA_get_real_size_test.php
new file mode 100644
index 0000000..894e22c
--- /dev/null
+++ b/test/libraries/core/PMA_get_real_size_test.php
@@ -0,0 +1,46 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_get_real_size() from libraries/core.lib.php
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/core.lib.php';
+
+class PMA_get_real_size_test extends PHPUnit_Framework_TestCase
+{
+ public function testNull()
+ {
+ $this->assertEquals(0, PMA_get_real_size('0'));
+ }
+
+ public function testKilobyte()
+ {
+ $this->assertEquals(1024, PMA_get_real_size('1kb'));
+ }
+
+ public function testKilobyte2()
+ {
+ $this->assertEquals(1024 * 1024, PMA_get_real_size('1024k'));
+ }
+
+ public function testMegabyte()
+ {
+ $this->assertEquals(8 * 1024 * 1024, PMA_get_real_size('8m'));
+ }
+
+ public function testGigabyte()
+ {
+ $this->assertEquals(12 * 1024 * 1024 * 1024, PMA_get_real_size('12gb'));
+ }
+
+ public function testUnspecified()
+ {
+ $this->assertEquals(1024, PMA_get_real_size('1024'));
+ }
+}
+?>
diff --git a/test/libraries/core/PMA_headerLocation_test_disabled.php b/test/libraries/core/PMA_headerLocation_test_disabled.php
new file mode 100644
index 0000000..b2f522d
--- /dev/null
+++ b/test/libraries/core/PMA_headerLocation_test_disabled.php
@@ -0,0 +1,301 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_sendHeaderLocation
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/common.lib.php';
+require_once 'libraries/url_generating.lib.php';
+require_once 'libraries/core.lib.php';
+require_once 'libraries/select_lang.lib.php';
+
+/**
+ * Test function sending headers.
+ * Warning - these tests set constants, so it can interfere with other tests
+ * If you have runkit extension, then it is possible to back changes made on constants
+ * rest of options can be tested only with apd, when functions header and headers_sent are redefined
+ * rename_function() of header and headers_sent may cause CLI error report in Windows XP (but tests are done correctly)
+ * additional functions which were created during tests must be stored to coverage test e.g.
+ *
+ * <code>rename_function('headers_sent', 'headers_sent'.str_replace(array('.', ' '),array('', ''),microtime()));</code>
+ *
+ * @package phpMyAdmin-test
+ */
+
+class PMA_headerLocation_test extends PHPUnit_Extensions_OutputTestCase
+{
+
+ protected $oldIISvalue;
+ protected $oldSIDvalue;
+ protected $runkitExt;
+ protected $apdExt;
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->runkitExt = false;
+ if (function_exists("runkit_constant_redefine"))
+ $this->runkitExt = true;
+
+ $this->apdExt = false;
+ if (function_exists("rename_function"))
+ $this->apdExt = true;
+
+
+ if ($this->apdExt && !$GLOBALS['test_header']) {
+
+ // using apd extension to overriding header and headers_sent functions for test purposes
+ $GLOBALS['test_header'] = 1;
+
+ // rename_function() of header and headers_sent may cause CLI error report in Windows XP
+ rename_function('header', 'test_header');
+ rename_function('headers_sent', 'test_headers_sent');
+
+ // solution from: http://unixwars.com/2008/11/29/override_function-in-php/ to overriding more than one function
+
+ $substs = array(
+ 'header' => 'if (isset($GLOBALS["header"])) $GLOBALS["header"] .= $a; else $GLOBALS["header"] = $a;',
+ 'headers_sent' => 'return false;'
+ );
+
+ $args = array(
+ 'header' => '$a',
+ 'headers_sent' => ''
+ );
+
+ foreach ($substs as $func => $ren_func) {
+ if (function_exists("__overridden__"))
+ rename_function("__overridden__", str_replace(array('.', ' '),array('', ''),microtime()));
+ override_function($func, $args[$func], $substs[$func]);
+ rename_function("__overridden__", str_replace(array('.', ' '),array('', ''),microtime()));
+ }
+
+ }
+ }
+
+ public function __destruct()
+ {
+ // rename_function may causes CLI error report in Windows XP, but nothing more happen
+
+ if ($this->apdExt && $GLOBALS['test_header']) {
+ $GLOBALS['test_header'] = 0;
+
+ rename_function('header', 'header'.str_replace(array('.', ' '),array('', ''),microtime()));
+ rename_function('headers_sent', 'headers_sent'.str_replace(array('.', ' '),array('', ''),microtime()));
+
+ rename_function('test_header', 'header');
+ rename_function('test_headers_sent', 'headers_sent');
+ }
+ }
+
+ public function setUp()
+ {
+ //session_start();
+
+ // cleaning constants
+ if ($this->runkitExt) {
+
+ $this->oldIISvalue = 'non-defined';
+
+ if (defined('PMA_IS_IIS')) {
+ $this->oldIISvalue = PMA_IS_IIS;
+ runkit_constant_redefine('PMA_IS_IIS', NULL);
+ }
+ else {
+ runkit_constant_add('PMA_IS_IIS', NULL);
+ }
+
+
+ $this->oldSIDvalue = 'non-defined';
+
+ if (defined('SID')) {
+ $this->oldSIDvalue = SID;
+ runkit_constant_redefine('SID', NULL);
+ }
+ else {
+ runkit_constant_add('SID', NULL);
+ }
+
+ }
+ }
+
+
+ public function tearDown()
+ {
+ //session_destroy();
+
+ // cleaning constants
+ if ($this->runkitExt) {
+
+ if ($this->oldIISvalue != 'non-defined')
+ runkit_constant_redefine('PMA_IS_IIS', $this->oldIISvalue);
+ elseif (defined('PMA_IS_IIS')) {
+ runkit_constant_remove('PMA_IS_IIS');
+ }
+
+ if ($this->oldSIDvalue != 'non-defined')
+ runkit_constant_redefine('SID', $this->oldSIDvalue);
+ elseif (defined('SID')) {
+ runkit_constant_remove('SID');
+ }
+ }
+
+ if ($this->apdExt)
+ unset($GLOBALS['header']);
+
+ }
+
+
+ public function testSendHeaderLocationWithSidUrlWithQuestionMark()
+ {
+ if ($this->runkitExt && $this->apdExt) {
+
+ runkit_constant_redefine('SID', md5('test_hash'));
+
+ $testUri = 'http://testurl.com/test.php?test=test';
+ $separator = PMA_get_arg_separator();
+
+ $header = 'Location: ' . $testUri . $separator . SID;
+
+ PMA_sendHeaderLocation($testUri); // sets $GLOBALS['header']
+ $this->assertEquals($header, $GLOBALS['header']);
+
+ } else {
+ $this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
+ }
+
+ }
+
+ public function testSendHeaderLocationWithSidUrlWithoutQuestionMark()
+ {
+ if ($this->runkitExt && $this->apdExt) {
+
+ runkit_constant_redefine('SID', md5('test_hash'));
+
+ $testUri = 'http://testurl.com/test.php';
+ $separator = PMA_get_arg_separator();
+
+ $header = 'Location: ' . $testUri . '?' . SID;
+
+ PMA_sendHeaderLocation($testUri); // sets $GLOBALS['header']
+ $this->assertEquals($header, $GLOBALS['header']);
+
+ } else {
+ $this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
+ }
+
+ }
+
+ public function testSendHeaderLocationWithoutSidWithIis()
+ {
+ if ($this->runkitExt && $this->apdExt) {
+
+ runkit_constant_redefine('PMA_IS_IIS', true);
+ runkit_constant_add('PMA_COMING_FROM_COOKIE_LOGIN', true);
+
+ $testUri = 'http://testurl.com/test.php';
+ $separator = PMA_get_arg_separator();
+
+ $header = 'Refresh: 0; ' . $testUri;
+
+ PMA_sendHeaderLocation($testUri); // sets $GLOBALS['header']
+
+ // cleaning constant
+ runkit_constant_remove('PMA_COMING_FROM_COOKIE_LOGIN');
+
+ $this->assertEquals($header, $GLOBALS['header']);
+
+ } else {
+ $this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
+ }
+
+ }
+
+ public function testSendHeaderLocationWithoutSidWithoutIis()
+ {
+ if ($this->apdExt) {
+
+ $testUri = 'http://testurl.com/test.php';
+ $header = 'Location: ' . $testUri;
+
+ PMA_sendHeaderLocation($testUri); // sets $GLOBALS['header']
+ $this->assertEquals($header, $GLOBALS['header']);
+
+ } else {
+ $this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
+ }
+
+ }
+
+ public function testSendHeaderLocationIisLongUri()
+ {
+ if (defined('PMA_IS_IIS') && $this->runkitExt)
+ runkit_constant_redefine('PMA_IS_IIS', true);
+ elseif (!defined('PMA_IS_IIS'))
+ define('PMA_IS_IIS', true);
+ else
+ $this->markTestSkipped('Cannot redefine constant/function - missing APD or/and runkit extension');
+
+
+ // over 600 chars
+ $testUri = 'http://testurl.com/test.php?testlonguri=over600chars&test=test&test=test&te…';
+ $testUri_html = htmlspecialchars($testUri);
+ $testUri_js = PMA_escapeJsString($testUri);
+
+ $header = "<html><head><title>- - -</title>\n" .
+ "<meta http-equiv=\"expires\" content=\"0\">\n" .
+ "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n" .
+ "<meta http-equiv=\"Cache-Control\" content=\"no-cache\">\n" .
+ "<meta http-equiv=\"Refresh\" content=\"0;url=" . $testUri_html . "\">\n" .
+ "<script type=\"text/javascript\">\n".
+ "//<![CDATA[\n" .
+ "setTimeout(\"window.location = unescape('\"" . $testUri_js . "\"')\", 2000);\n" .
+ "//]]>\n" .
+ "</script>\n" .
+ "</head>\n" .
+ "<body>\n" .
+ "<script type=\"text/javascript\">\n" .
+ "//<![CDATA[\n" .
+ "document.write('<p><a href=\"" . $testUri_html . "\">" . __('Go') . "</a></p>');\n" .
+ "//]]>\n" .
+ "</script></body></html>\n";
+
+
+ $this->expectOutputString($header);
+
+ PMA_sendHeaderLocation($testUri);
+ }
+
+ /**
+ * other output tests
+ */
+
+ public function testWriteReloadNavigation()
+ {
+ $GLOBALS['reload'] = true;
+ $GLOBALS['db'] = 'test_db';
+
+ $url = './navigation.php?'.PMA_generate_common_url($GLOBALS['db'], '', '&');
+ $write = PHP_EOL . '<script type="text/javascript">' . PHP_EOL .
+ '//<![CDATA[' . PHP_EOL .
+ 'if (typeof(window.parent) != \'undefined\'' . PHP_EOL .
+ ' && typeof(window.parent.frame_navigation) != \'undefined\'' . PHP_EOL .
+ ' && window.parent.goTo) {' . PHP_EOL .
+ ' window.parent.goTo(\'' . $url . '\');' . PHP_EOL .
+ '}' . PHP_EOL .
+ '//]]>' . PHP_EOL .
+ '</script>' . PHP_EOL;
+
+ $this->expectOutputString($write);
+ PMA_reloadNavigation();
+
+ $this->assertFalse(isset($GLOBALS['reload']));
+ unset($GLOBALS['db']);
+ }
+}
+?>
diff --git a/test/libraries/core/PMA_ifSetOr_test.php b/test/libraries/core/PMA_ifSetOr_test.php
new file mode 100644
index 0000000..35ffa96
--- /dev/null
+++ b/test/libraries/core/PMA_ifSetOr_test.php
@@ -0,0 +1,45 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Tests for PMA_ifSetOr() from libraries/core.lib.php
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/core.lib.php';
+
+class PMA_ifSetOr_test extends PHPUnit_Framework_TestCase
+{
+ public function testVarSet()
+ {
+ $default = 'foo';
+ $in = 'bar';
+ $out = PMA_ifSetOr($in, $default);
+ $this->assertEquals($in, $out);
+ }
+ public function testVarSetWrongType()
+ {
+ $default = 'foo';
+ $in = 'bar';
+ $out = PMA_ifSetOr($in, $default, 'boolean');
+ $this->assertEquals($out, $default);
+ }
+ public function testVarNotSet()
+ {
+ $default = 'foo';
+ // $in is not set!
+ $out = PMA_ifSetOr($in, $default);
+ $this->assertEquals($out, $default);
+ }
+ public function testVarNotSetNoDefault()
+ {
+ // $in is not set!
+ $out = PMA_ifSetOr($in);
+ $this->assertEquals($out, null);
+ }
+
+}
+?>
diff --git a/test/libraries/core/PMA_isValid_test.php b/test/libraries/core/PMA_isValid_test.php
new file mode 100644
index 0000000..5bd3367
--- /dev/null
+++ b/test/libraries/core/PMA_isValid_test.php
@@ -0,0 +1,217 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Tests for PMA_isValid() from libraries/core.lib.php
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/core.lib.php';
+
+class PMA_isValid_test extends PHPUnit_Framework_TestCase
+{
+ public static function providerNoVarTypeProvider()
+ {
+ return array(
+ array(0, false, 0),
+ array(0, false, 1),
+ array(1, false, null),
+ array(1.1, false, null),
+ array('', false, null),
+ array(' ', false, null),
+ array('0', false, null),
+ array('string', false, null),
+ array(array(), false, null),
+ array(array(1, 2, 3), false, null),
+ array(true, false, null),
+ array(false, false, null));
+ }
+
+ /**
+ * @dataProvider providerNoVarTypeProvider
+ * @param mixed $var
+ * @param mixed $type
+ * @param mixed $compare
+ */
+ public function testNoVarType($var, $type, $compare)
+ {
+ $this->assertTrue(PMA_isValid($var, $type, $compare));
+ }
+
+ public function testVarNotSetAfterTest()
+ {
+ PMA_isValid($var);
+ $this->assertFalse(isset($var));
+ }
+
+ public function testNotSet()
+ {
+ $this->assertFalse(PMA_isValid($var));
+ }
+
+ public function testEmptyString()
+ {
+ $var = '';
+ $this->assertFalse(PMA_isValid($var));
+ }
+
+ public function testNotEmptyString()
+ {
+ $var = '0';
+ $this->assertTrue(PMA_isValid($var));
+ }
+
+ public function testZero()
+ {
+ $var = 0;
+ $this->assertTrue(PMA_isValid($var));
+ $this->assertTrue(PMA_isValid($var, 'int'));
+ }
+
+ public function testNullFail()
+ {
+ $var = null;
+ $this->assertFalse(PMA_isValid($var));
+
+ $var = 'null_text';
+ $this->assertFalse(PMA_isValid($var, 'null'));
+ }
+
+ public function testNotSetArray()
+ {
+ /** @var $array undefined array */
+ $this->assertFalse(PMA_isValid($array['x']));
+ }
+
+ public function testScalarString()
+ {
+ $var = 'string';
+ $this->assertTrue(PMA_isValid($var, 'len'));
+ $this->assertTrue(PMA_isValid($var, 'scalar'));
+ $this->assertTrue(PMA_isValid($var));
+ }
+
+ public function testScalarInt()
+ {
+ $var = 1;
+ $this->assertTrue(PMA_isValid($var, 'int'));
+ $this->assertTrue(PMA_isValid($var, 'scalar'));
+ }
+
+ public function testScalarFloat()
+ {
+ $var = 1.1;
+ $this->assertTrue(PMA_isValid($var, 'float'));
+ $this->assertTrue(PMA_isValid($var, 'double'));
+ $this->assertTrue(PMA_isValid($var, 'scalar'));
+ }
+
+ public function testScalarBool()
+ {
+ $var = true;
+ $this->assertTrue(PMA_isValid($var, 'scalar'));
+ $this->assertTrue(PMA_isValid($var, 'bool'));
+ $this->assertTrue(PMA_isValid($var, 'boolean'));
+ }
+
+ public function testNotScalarArray()
+ {
+ $var = array('test');
+ $this->assertFalse(PMA_isValid($var, 'scalar'));
+ }
+
+ public function testNotScalarNull()
+ {
+ $var = null;
+ $this->assertFalse(PMA_isValid($var, 'scalar'));
+ }
+
+ public function testNumericInt()
+ {
+ $var = 1;
+ $this->assertTrue(PMA_isValid($var, 'numeric'));
+ }
+
+ public function testNumericFloat()
+ {
+ $var = 1.1;
+ $this->assertTrue(PMA_isValid($var, 'numeric'));
+ }
+
+ public function testNumericZero()
+ {
+ $var = 0;
+ $this->assertTrue(PMA_isValid($var, 'numeric'));
+ }
+
+ public function testNumericString()
+ {
+ $var = '+0.1';
+ $this->assertTrue(PMA_isValid($var, 'numeric'));
+ }
+
+ public function testValueInArray()
+ {
+ $var = 'a';
+ $this->assertTrue(PMA_isValid($var, array('a', 'b',)));
+ }
+
+ public function testValueNotInArray()
+ {
+ $var = 'c';
+ $this->assertFalse(PMA_isValid($var, array('a', 'b',)));
+ }
+
+ public function testNumericIdentical()
+ {
+ $var = 1;
+ $compare = 1;
+ $this->assertTrue(PMA_isValid($var, 'identic', $compare));
+
+ $var = 1;
+ $compare += 2;
+ $this->assertFalse(PMA_isValid($var, 'identic', $compare));
+
+ $var = 1;
+ $compare = '1';
+ $this->assertFalse(PMA_isValid($var, 'identic', $compare));
+ }
+
+ public function providerSimilarType()
+ {
+ return array(
+ array(1, 1),
+ array(1.5, 1.5),
+ array(true, true),
+ array('string', "string"),
+ array(array(1, 2, 3.4), array(1, 2, 3.4)),
+ array(array(1, '2', '3.4', 5, 'text'), array('1', '2', 3.4,'5'))
+ );
+ }
+
+ /**
+ * @dataProvider providerSimilarType
+ * @param mixed $var
+ * @param mixed $compare
+ */
+ public function testSimilarType($var, $compare)
+ {
+ $this->assertTrue(PMA_isValid($var, 'similar', $compare));
+ $this->assertTrue(PMA_isValid($var, 'equal', $compare));
+ $this->assertTrue(PMA_isValid($compare, 'similar', $var));
+ $this->assertTrue(PMA_isValid($compare, 'equal', $var));
+
+ }
+
+ public function testOtherTypes()
+ {
+ $var = new PMA_isValid_test();
+ $this->assertFalse(PMA_isValid($var, 'class'));
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/test/libraries/core/PMA_securePath_test.php b/test/libraries/core/PMA_securePath_test.php
new file mode 100644
index 0000000..6663264
--- /dev/null
+++ b/test/libraries/core/PMA_securePath_test.php
@@ -0,0 +1,19 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Tests for PMA_securePath() from libraries/core.lib.php
+ * PMA_securePath changes .. to .
+ *
+ * @package phpMyAdmin-test
+ */
+
+require_once 'libraries/core.lib.php';
+
+class PMA_securePath extends PHPUnit_Framework_TestCase{
+ public function testReplaceDots(){
+ $this->assertEquals(PMA_securePath('../../../etc/passwd'), './././etc/passwd');
+ $this->assertEquals(PMA_securePath('/var/www/../phpmyadmin'), '/var/www/./phpmyadmin');
+ $this->assertEquals(PMA_securePath('./path/with..dots/../../file..php'), './path/with.dots/././file.php');
+ }
+
+}
\ No newline at end of file
diff --git a/test/libraries/core/PMA_warnMissingExtension_test.php b/test/libraries/core/PMA_warnMissingExtension_test.php
new file mode 100644
index 0000000..4c31db1
--- /dev/null
+++ b/test/libraries/core/PMA_warnMissingExtension_test.php
@@ -0,0 +1,58 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_warnMissingExtension() from libraries/core.lib.php
+ * PMA_warnMissingExtension warns or fails on missing extension.
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/core.lib.php';
+
+class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase{
+
+ function testMissingExtention(){
+ $ext = 'php_ext';
+ $this->setExpectedException('PHPUnit_Framework_Error',
+ 'The [a@'.PMA_getPHPDocLink('book.' . $ext . '.php').'@Documentation][em]'.$ext.'[/em][/a] extension is missing. Please check your PHP configuration.');
+ PMA_warnMissingExtension($ext);
+ }
+
+ function testMissingExtentionFatal(){
+ $ext = 'php_ext';
+ $warn = 'The <a href="'.PMA_linkURL(PMA_getPHPDocLink('book.' . $ext . '.php')).'" target="Documentation"><em>'.$ext.'</em></a> extension is missing. Please check your PHP configuration.';
+
+ ob_start();
+ PMA_warnMissingExtension($ext,true);
+ $printed = ob_get_contents();
+ ob_end_clean();
+
+ $this->assertGreaterThan(0,strpos($printed,$warn));
+ }
+
+ function testMissingExtentionFatalWithExtra(){
+ $ext = 'php_ext';
+ $extra = 'Appended Extra String';
+
+ $warn = 'The <a href="'.PMA_linkURL(PMA_getPHPDocLink('book.' . $ext . '.php')).'" target="Documentation"><em>'.$ext.'</em></a> extension is missing. Please check your PHP configuration.'.' '.$extra;
+
+ ob_start();
+ PMA_warnMissingExtension($ext,true,$extra);
+ $printed = ob_get_contents();
+ ob_end_clean();
+
+ $this->assertGreaterThan(0,strpos($printed,$warn));
+ }
+
+ function testMissingExtentionWithExtra(){
+ $ext = 'php_ext';
+ $extra = 'Appended Extra String';
+ $this->setExpectedException('PHPUnit_Framework_Error',
+ 'The [a@'.PMA_getPHPDocLink('book.' . $ext . '.php').'@Documentation][em]'.$ext.'[/em][/a] extension is missing. Please check your PHP configuration.'.' '.$extra);
+ PMA_warnMissingExtension($ext,false,$extra);
+ $this->assertTrue(true);
+ }
+}
diff --git a/test/libraries/php-gettext/Locales_test.php b/test/libraries/php-gettext/Locales_test.php
new file mode 100644
index 0000000..d8a0981
--- /dev/null
+++ b/test/libraries/php-gettext/Locales_test.php
@@ -0,0 +1,73 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for gettext locales.
+ *
+ * @package phpMyAdmin-test
+ */
+require_once('libraries/php-gettext/gettext.inc');
+
+class LocaleTest extends PHPUnit_Framework_TestCase
+{
+
+ public function test_setlocale_system()
+ {
+ putenv("LC_ALL=");
+ // For an existing locale, it never needs emulation.
+ putenv("LANG=C");
+ _setlocale(LC_MESSAGES, "");
+ $this->assertEquals(0, locale_emulation());
+ }
+
+ public function test_setlocale_emulation()
+ {
+ putenv("LC_ALL=");
+ // If we set it to a non-existent locale, it still works, but uses
+ // emulation.
+ _setlocale(LC_MESSAGES, "xxx_XXX");
+ $this->assertEquals('xxx_XXX', _setlocale(LC_MESSAGES, 0));
+ $this->assertEquals(1, locale_emulation());
+ }
+
+ public function test_get_list_of_locales()
+ {
+ // For a locale containing country code, we prefer
+ // full locale name, but if that's not found, fall back
+ // to the language only locale name.
+ $this->assertEquals(array("sr_RS", "sr"),
+ get_list_of_locales("sr_RS"));
+
+ // If language code is used, it's the only thing returned.
+ $this->assertEquals(array("sr"),
+ get_list_of_locales("sr"));
+
+ // There is support for language and charset only.
+ $this->assertEquals(array("sr.UTF-8", "sr"),
+ get_list_of_locales("sr.UTF-8"));
+
+ // It can also split out character set from the full locale name.
+ $this->assertEquals(array("sr_RS.UTF-8", "sr_RS", "sr"),
+ get_list_of_locales("sr_RS.UTF-8"));
+
+ // There is support for @modifier in locale names as well.
+ $this->assertEquals(array("sr_RS.UTF-8@latin", "sr_RS@latin", "sr@latin",
+ "sr_RS.UTF-8", "sr_RS", "sr"),
+ get_list_of_locales("sr_RS.UTF-8@latin"));
+
+ // We can pass in only language and modifier.
+ $this->assertEquals(array("sr@latin", "sr"),
+ get_list_of_locales("sr@latin"));
+
+
+ // If locale name is not following the regular POSIX pattern,
+ // it's used verbatim.
+ $this->assertEquals(array("something"),
+ get_list_of_locales("something"));
+
+ // Passing in an empty string returns an empty array.
+ $this->assertEquals(array(),
+ get_list_of_locales(""));
+ }
+}
+
+?>
diff --git a/test/libraries/php-gettext/Parsing_test.php b/test/libraries/php-gettext/Parsing_test.php
new file mode 100644
index 0000000..c4fc461
--- /dev/null
+++ b/test/libraries/php-gettext/Parsing_test.php
@@ -0,0 +1,65 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for gettext parsing.
+ *
+ * @package phpMyAdmin-test
+ */
+//require_once('gettext.php');
+
+class ParsingTest extends PHPUnit_Framework_TestCase
+{
+ public function test_extract_plural_forms_header_from_po_header()
+ {
+ $parser = new gettext_reader(NULL);
+ // It defaults to a "Western-style" plural header.
+ $this->assertEquals(
+ 'nplurals=2; plural=n == 1 ? 0 : 1;',
+ $parser->extract_plural_forms_header_from_po_header(""));
+
+ // Extracting it from the middle of the header works.
+ $this->assertEquals(
+ 'nplurals=1; plural=0;',
+ $parser->extract_plural_forms_header_from_po_header(
+ "Content-type: text/html; charset=UTF-8\n"
+ ."Plural-Forms: nplurals=1; plural=0;\n"
+ ."Last-Translator: nobody\n"
+ ));
+
+ // It's also case-insensitive.
+ $this->assertEquals(
+ 'nplurals=1; plural=0;',
+ $parser->extract_plural_forms_header_from_po_header(
+ "PLURAL-forms: nplurals=1; plural=0;\n"
+ ));
+
+ // It falls back to default if it's not on a separate line.
+ $this->assertEquals(
+ 'nplurals=2; plural=n == 1 ? 0 : 1;',
+ $parser->extract_plural_forms_header_from_po_header(
+ "Content-type: text/html; charset=UTF-8" // note the missing \n here
+ ."Plural-Forms: nplurals=1; plural=0;\n"
+ ."Last-Translator: nobody\n"
+ ));
+ }
+
+ /**
+ * @dataProvider data_provider_test_npgettext
+ */
+ public function test_npgettext($number, $expected) {
+ $parser = new gettext_reader(NULL);
+ $result = $parser->npgettext("context",
+ "%d pig went to the market\n",
+ "%d pigs went to the market\n",
+ $number);
+ $this->assertSame($expected, $result);
+ }
+ public static function data_provider_test_npgettext() {
+ return array(
+ array(1, "%d pig went to the market\n"),
+ array(2, "%d pigs went to the market\n"),
+ );
+ }
+
+}
+?>
diff --git a/test/libraries/select_lang/PMA_langDetails_test.php b/test/libraries/select_lang/PMA_langDetails_test.php
new file mode 100644
index 0000000..ca758ed
--- /dev/null
+++ b/test/libraries/select_lang/PMA_langDetails_test.php
@@ -0,0 +1,96 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_langDetails from select_lang.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_langDetails_test.php
+ * @group select_lang.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/select_lang.lib.php';
+
+class PMA_langDetails_test extends PHPUnit_Framework_TestCase
+{
+ function dataProvider()
+ {
+ return array(
+ array('af|afrikaans', 'af', '', 'af'),
+ array('ar|arabic', 'ar', 'العربية', 'ar'),
+ array('az|azerbaijani', 'az', 'Azərbaycanca', 'az'),
+ array('bn|bangla', 'bn', 'বাংলা', 'bn'),
+ array('be|belarusian', 'be', 'Беларуская', 'be'),
+ array('be[-_]lat|belarusian latin', 'be-lat', 'Biełaruskaja', 'be@latin'),
+ array('bg|bulgarian', 'bg', 'Български', 'bg'),
+ array('bs|bosnian', 'bs', 'Bosanski', 'bs'),
+ array('br|breton', 'br', 'Brezhoneg', 'br'),
+ array('ca|catalan', 'ca', 'Català', 'ca'),
+ array('cs|czech', 'cs', 'Čeština', 'cs'),
+ array('cy|welsh', 'cy', 'Cymraeg', 'cy'),
+ array('da|danish', 'da', 'Dansk', 'da'),
+ array('de|german', 'de', 'Deutsch', 'de'),
+ array('el|greek', 'el', 'Ελληνικά', 'el'),
+ array('en|english', 'en', '', 'en'),
+ array('en[_-]gb|english (United Kingdom)', 'en-gb', '', 'en_GB'),
+ array('es|spanish', 'es', 'Español', 'es'),
+ array('et|estonian', 'et', 'Eesti', 'et'),
+ array('eu|basque', 'eu', 'Euskara', 'eu',),
+ array('fa|persian', 'fa', 'فارسی', 'fa'),
+ array('fi|finnish', 'fi', 'Suomi', 'fi'),
+ array('fr|french', 'fr', 'Français', 'fr'),
+ array('gl|galician', 'gl', 'Galego', 'gl'),
+ array('he|hebrew', 'he', 'עברית', 'he'),
+ array('hi|hindi', 'hi', 'हिन्दी', 'hi'),
+ array('hr|croatian', 'hr', 'Hrvatski', 'hr'),
+ array('hu|hungarian', 'hu', 'Magyar', 'hu'),
+ array('id|indonesian', 'id', 'Bahasa Indonesia', 'id'),
+ array('it|italian', 'it', 'Italiano', 'it'),
+ array('ja|japanese', 'ja', '日本語', 'ja'),
+ array('ko|korean', 'ko', '한국어', 'ko'),
+ array('ka|georgian', 'ka', 'ქართული', 'ka'),
+ array('lt|lithuanian', 'lt', 'Lietuvių', 'lt'),
+ array('lv|latvian', 'lv', 'Latviešu', 'lv'),
+ array('mk|macedonian', 'mk', 'Macedonian', 'mk'),
+ array('mn|mongolian', 'mn', 'Монгол', 'mn'),
+ array('ms|malay', 'ms', 'Bahasa Melayu', 'ms'),
+ array('nl|dutch', 'nl', 'Nederlands', 'nl'),
+ array('nb|norwegian', 'nb', 'Norsk', 'nb'),
+ array('pl|polish', 'pl', 'Polski', 'pl'),
+ array('pt[-_]br|brazilian portuguese', 'pt-BR', 'Português', 'pt_BR'),
+ array('pt|portuguese', 'pt', 'Português', 'pt'),
+ array('ro|romanian', 'ro', 'Română', 'ro'),
+ array('ru|russian', 'ru', 'Русский', 'ru'),
+ array('si|sinhala', 'si', 'සිංහල', 'si'),
+ array('sk|slovak', 'sk', 'Slovenčina', 'sk'),
+ array('sl|slovenian', 'sl', 'Slovenščina', 'sl'),
+ array('sq|albanian', 'sq', 'Shqip', 'sq'),
+ array('sr[-_]lat|serbian latin', 'sr-lat', 'Srpski', 'sr@latin'),
+ array('sr|serbian', 'sr', 'Српски', 'sr'),
+ array('sv|swedish', 'sv', 'Svenska', 'sv'),
+ array('ta|tamil', 'ta', 'தமிழ்', 'ta'),
+ array('te|telugu', 'te', 'తెలుగు', 'te'),
+ array('th|thai', 'th', 'ภาษาไทย', 'th'),
+ array('tr|turkish', 'tr', 'Türkçe', 'tr'),
+ array('tt|tatarish', 'tt', 'Tatarça', 'tt'),
+ array('ug|uyghur', 'ug', 'ئۇيغۇرچە', 'ug'),
+ array('uk|ukrainian', 'uk', 'Українська', 'uk'),
+ array('ur|urdu', 'ur', 'اُردوُ', 'ur'),
+ array('uz[-_]lat|uzbek-latin', 'uz-lat', 'O‘zbekcha', 'uz@latin'),
+ array('uz[-_]cyr|uzbek-cyrillic', 'uz-cyr', 'Ўзбекча', 'uz'),
+ array('zh[-_](tw|hk)|chinese traditional', 'zh-TW', '中文', 'zh_TW'),
+ array('zh|chinese simplified', 'zh', '中文', 'zh_CN'),
+ array('test_lang|test_lang', 'test_lang', 'test_lang', 'test_lang')
+ );
+ }
+
+ /**
+ * @dataProvider dataProvider
+ */
+ function testLangDetails($a, $b, $c,$d)
+ {
+ $this->assertEquals(array($a, $b, $c), PMA_langDetails($d));
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/select_lang/PMA_langList_test.php b/test/libraries/select_lang/PMA_langList_test.php
new file mode 100644
index 0000000..354668b
--- /dev/null
+++ b/test/libraries/select_lang/PMA_langList_test.php
@@ -0,0 +1,51 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_langList from select_lang.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_langList_test.php
+ * @group select_lang.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/select_lang.lib.php';
+
+class PMA_langList_test extends PHPUnit_Framework_TestCase
+{
+ function testLangList()
+ {
+ $GLOBALS['lang_path'] = '';
+ $expected = array('en' => PMA_langDetails('en'));
+
+ $this->assertEquals($expected, PMA_langList());
+ }
+
+ function testLangListWithDir()
+ {
+ $GLOBALS['lang_path'] = './locale/';
+ $expected = array('en' => PMA_langDetails('en'));
+
+ $handle = @opendir($GLOBALS['lang_path']);
+ if ($handle === false)
+ $this->markTestSkipped("Cannot open file with locales");
+
+ while (false !== ($file = readdir($handle))) {
+ if ($file != "." && $file != ".." && file_exists($GLOBALS['lang_path'] . '/' . $file . '/LC_MESSAGES/phpmyadmin.mo')) {
+ $expected[$file] = PMA_langDetails($file);
+ }
+ }
+
+ $this->assertEquals($expected, PMA_langList());
+ }
+
+ function testLangListWithWrongDir()
+ {
+ $GLOBALS['lang_path'] = '/root/';
+ $expected = array('en' => PMA_langDetails('en'));
+
+ $this->assertEquals($expected, PMA_langList());
+ }
+}
\ No newline at end of file
diff --git a/test/libraries/select_lang/PMA_langName_test.php b/test/libraries/select_lang/PMA_langName_test.php
new file mode 100644
index 0000000..892d114
--- /dev/null
+++ b/test/libraries/select_lang/PMA_langName_test.php
@@ -0,0 +1,35 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for PMA_langName from select_lang.lib.php
+ *
+ * @package phpMyAdmin-test
+ * @version $Id: PMA_langName_test.php
+ * @group select_lang.lib-tests
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/select_lang.lib.php';
+
+class PMA_langName_test extends PHPUnit_Framework_TestCase
+{
+ function dataProvider()
+ {
+ return array(
+ array(array('en|english', 'en', ''),'English'),
+ array(array('fr|french', 'fr', 'Français'), 'Français - French'),
+ array(array('zh|chinese simplified', 'zh', '中文'), '中文 - Chinese simplified'),
+ );
+ }
+
+ /**
+ * @dataProvider dataProvider
+ * @return void
+ */
+ function testLangName($test, $result)
+ {
+ $this->assertEquals($result, PMA_langName($test));
+ }
+}
\ No newline at end of file
diff --git a/test/selenium/PmaSeleniumLoginTest.php b/test/selenium/PmaSeleniumLoginTest.php
new file mode 100644
index 0000000..8f14fce
--- /dev/null
+++ b/test/selenium/PmaSeleniumLoginTest.php
@@ -0,0 +1,43 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Selenium TestCase for login related tests
+ *
+ * @package phpMyAdmin-test
+ * @group Selenium
+ */
+
+require_once('PmaSeleniumTestCase.php');
+
+
+class PmaSeleniumLoginTest extends PmaSeleniumTestCase
+{
+ protected $captureScreenshotOnFailure = TRUE;
+ protected $screenshotPath = '/var/www/screenshots';
+ protected $screenshotUrl = 'http://localhost/screenshots';
+
+ public function testLogin()
+ {
+ $this->doLogin();
+
+ // Check if login error happend
+ if ($this->isElementPresent("//html/body/div/div[@class='error']")){
+ $this->fail($this->getText("//html/body/div/div[@class='error']"));
+ }
+
+ // Check server info heder is present //*[@id="serverinfo"]
+ for ($second = 0;; $second++) {
+ if ($second >= 60)
+ $this->fail("Timeout waiting main page to load!");
+ try {
+ if ($this->isElementPresent("//*[@id=\"serverinfo\"]"))
+ break;
+ } catch (Exception $e) {
+ $this->fail("Exception: ".$e->getMessage());
+ }
+ sleep(1);
+ }
+
+ }
+}
+?>
diff --git a/test/selenium/PmaSeleniumPrivilegesTest.php b/test/selenium/PmaSeleniumPrivilegesTest.php
new file mode 100644
index 0000000..a325347
--- /dev/null
+++ b/test/selenium/PmaSeleniumPrivilegesTest.php
@@ -0,0 +1,48 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Selenium TestCase for privilege related tests
+ *
+ * @package phpMyAdmin-test
+ * @group Selenium
+ */
+
+require_once('PmaSeleniumTestCase.php');
+
+
+class PmaSeleniumPrivilegesTest extends PmaSeleniumTestCase
+{
+ public function testChangePassword()
+ {
+ $this->doLogin();
+ $this->selectFrame("frame_content");
+ $this->click("link=Change password");
+ $this->waitForPageToLoad("30000");
+ try {
+ $this->assertEquals("", $this->getValue("text_pma_pw"));
+ } catch (PHPUnit_Framework_AssertionFailedError $e) {
+ array_push($this->verificationErrors, $e->toString());
+ }
+ try {
+ $this->assertEquals("", $this->getValue("text_pma_pw2"));
+ } catch (PHPUnit_Framework_AssertionFailedError $e) {
+ array_push($this->verificationErrors, $e->toString());
+ }
+ try {
+ $this->assertEquals("", $this->getValue("generated_pw"));
+ } catch (PHPUnit_Framework_AssertionFailedError $e) {
+ array_push($this->verificationErrors, $e->toString());
+ }
+ $this->click("button_generate_password");
+ $this->assertNotEquals("", $this->getValue("text_pma_pw"));
+ $this->assertNotEquals("", $this->getValue("text_pma_pw2"));
+ $this->assertNotEquals("", $this->getValue("generated_pw"));
+ $this->type("text_pma_pw", $this->cfg['Test']['testuser']['password']);
+ $this->type("text_pma_pw2", $this->cfg['Test']['testuser']['password']);
+ $this->click("change_pw");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent(""));
+ $this->assertTrue($this->isTextPresent(""));
+ }
+}
+?>
diff --git a/test/selenium/PmaSeleniumTestCase.php b/test/selenium/PmaSeleniumTestCase.php
new file mode 100644
index 0000000..7bf7a61
--- /dev/null
+++ b/test/selenium/PmaSeleniumTestCase.php
@@ -0,0 +1,71 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Selenium parent class for TestCases
+ *
+ * @package phpMyAdmin-test
+ * @group Selenium
+ */
+
+// Optionally add the php-client-driver to your include path
+//set_include_path(get_include_path() . PATH_SEPARATOR . '/opt/selenium-remote-control-1.0.1/selenium-php-client-driver-1.0.1/PEAR/');
+
+// Include the main phpMyAdmin user config
+// currently only $cfg['Test'] is used
+require_once 'config.sample.inc.php';
+
+
+
+class PmaSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase
+{
+ protected $selenium;
+ protected $cfg;
+
+ protected $captureScreenshotOnFailure = TRUE;
+ protected $screenshotPath = '/var/www/screenshots';
+ protected $screenshotUrl = 'http://localhost/screenshots';
+
+ public function setUp()
+ {
+ global $cfg;
+ $this->cfg =& $cfg;
+ //PHPUnit_Extensions_SeleniumTestCase::$browsers = $this->cfg['Test']['broswers'];
+
+ $this->setBrowserUrl(TESTSUITE_PHPMYADMIN_HOST . TESTSUITE_PHPMYADMIN_URL);
+
+ $this->start();
+ }
+
+ public function tearDown()
+ {
+ $this->stop();
+ }
+
+ /**
+ * perform a login
+ */
+ public function doLogin()
+ {
+ $this->open(TESTSUITE_PHPMYADMIN_URL);
+ // Somehow selenium does not like the language selection on the cookie login page, forced English in the config for now.
+ //$this->select("lang", "label=English");
+
+ $this->waitForPageToLoad("30000");
+ $this->type("input_username", TESTSUITE_USER);
+ $this->type("input_password", TESTSUITE_PASSWORD);
+ $this->click("input_go");
+ $this->waitForPageToLoad("30001");
+ }
+
+ /*
+ * Just a dummy to show some example statements
+ *
+ public function mockTest()
+ {
+ // Slow down the testing speed, ideal for debugging
+ //$this->setSpeed(4000);
+}
+ */
+}
+
+?>
diff --git a/test/selenium/PmaSeleniumXssTest.php b/test/selenium/PmaSeleniumXssTest.php
new file mode 100644
index 0000000..4f551a0
--- /dev/null
+++ b/test/selenium/PmaSeleniumXssTest.php
@@ -0,0 +1,25 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Selenium TestCase for XSS related tests
+ *
+ * @package phpMyAdmin-test
+ * @group Selenium
+ */
+
+require_once('PmaSeleniumTestCase.php');
+
+class PmaSeleniumXSSTest extends PmaSeleniumTestCase
+{
+ public function testXssQueryTab()
+ {
+ $this->doLogin();
+ $this->selectFrame("frame_content");
+ $this->click("link=SQL");
+ $this->waitForPageToLoad("30000");
+ $this->type("sqlquery", "'\"><script>alert(123);</script>");
+ $this->click("SQL");
+ // If an alert pops up the test fails, since we don't handle an alert.
+ }
+}
+?>
diff --git a/themes/original/css/theme_left.css.php b/themes/original/css/theme_left.css.php
index f21bca2..9901ed4 100644
--- a/themes/original/css/theme_left.css.php
+++ b/themes/original/css/theme_left.css.php
@@ -8,7 +8,7 @@
*/
// unplanned execution path
-if (!defined('PMA_MINIMUM_COMMON')) {
+if (!defined('PMA_MINIMUM_COMMON') && !defined('TESTSUITE')) {
exit();
}
?>
diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php
index 5445d88..22a5494 100644
--- a/themes/original/css/theme_right.css.php
+++ b/themes/original/css/theme_right.css.php
@@ -8,7 +8,7 @@
*/
// unplanned execution path
-if (!defined('PMA_MINIMUM_COMMON')) {
+if (!defined('PMA_MINIMUM_COMMON') && !defined('TESTSUITE')) {
exit();
}
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-9535-g40ccdcb
by Marc Delisle 19 Jul '11
by Marc Delisle 19 Jul '11
19 Jul '11
The branch, master has been updated
via 40ccdcb2366e03fa5a03c41ad9c0bbc5c60feaa0 (commit)
from 964664525cd657ba52e82dd47c4314143ccd2516 (commit)
- Log -----------------------------------------------------------------
commit 40ccdcb2366e03fa5a03c41ad9c0bbc5c60feaa0
Author: Tyron Madlener <tyronx(a)gmail.com>
Date: Tue Jul 19 21:44:53 2011 +0300
Remove duplicate intialization
-----------------------------------------------------------------------
Summary of changes:
js/sql.js | 18 ------------------
1 files changed, 0 insertions(+), 18 deletions(-)
diff --git a/js/sql.js b/js/sql.js
index 3f778e1..c1106cd 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -170,24 +170,6 @@ $(document).ready(function() {
$("#sqlqueryresults").live('refreshgrid', function() {
$('#table_results').refreshgrid();
})
-
- /**
- * Attach the {@link makegrid} function to a custom event, which will be
- * triggered manually everytime the table of results is reloaded
- * @memberOf jQuery
- */
- $("#sqlqueryresults").live('makegrid', function() {
- $('#table_results').makegrid();
- })
-
- /**
- * Attach the {@link refreshgrid} function to a custom event, which will be
- * triggered manually everytime the table of results is manipulated (e.g., by inline edit)
- * @memberOf jQuery
- */
- $("#sqlqueryresults").live('refreshgrid', function() {
- $('#table_results').refreshgrid();
- })
/**
* Trigger the appendAnchor event to prepare the first table for inline edit
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-9534-g9646645
by Marc Delisle 19 Jul '11
by Marc Delisle 19 Jul '11
19 Jul '11
The branch, master has been updated
via 964664525cd657ba52e82dd47c4314143ccd2516 (commit)
from 7a40f19f8a00ea73df9d03d50d5e95c455420317 (commit)
- Log -----------------------------------------------------------------
commit 964664525cd657ba52e82dd47c4314143ccd2516
Author: Marc Delisle <marc(a)infomarc.info>
Date: Tue Jul 19 12:16:16 2011 -0400
Streamline jQuery usage
-----------------------------------------------------------------------
Summary of changes:
js/sql.js | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/js/sql.js b/js/sql.js
index 5c48578..3f778e1 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -334,16 +334,18 @@ $(document).ready(function() {
var $msgbox = PMA_ajaxShowMessage();
/**
- * @var $the_form Object referring to the form element that paginates the results table
+ * @var $form Object referring to the form element that paginates the results table
*/
- var $the_form = $(this).parent("form");
+ var $form = $(this).parent("form");
+
+ var $sqlqueryresults = $("#sqlqueryresults");
- $the_form.append('<input type="hidden" name="ajax_request" value="true" />');
+ PMA_prepareForAjaxRequest($form);
- $.post($the_form.attr('action'), $the_form.serialize(), function(data) {
- $("#sqlqueryresults").html(data);
- $("#sqlqueryresults").trigger('appendAnchor');
- $("#sqlqueryresults").trigger('makegrid');
+ $.post($form.attr('action'), $form.serialize(), function(data) {
+ $sqlqueryresults.html(data);
+ $sqlqueryresults.trigger('appendAnchor');
+ $sqlqueryresults.trigger('makegrid');
PMA_init_slider();
PMA_ajaxRemoveMessage($msgbox);
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-9533-g7a40f19
by Marc Delisle 19 Jul '11
by Marc Delisle 19 Jul '11
19 Jul '11
The branch, master has been updated
via 7a40f19f8a00ea73df9d03d50d5e95c455420317 (commit)
from a463231e0ff89ea8e433a266c72427dfc40d6965 (commit)
- Log -----------------------------------------------------------------
commit 7a40f19f8a00ea73df9d03d50d5e95c455420317
Author: Marc Delisle <marc(a)infomarc.info>
Date: Tue Jul 19 12:02:56 2011 -0400
Streamline jQuery usage
-----------------------------------------------------------------------
Summary of changes:
js/sql.js | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/js/sql.js b/js/sql.js
index d16abb0..5c48578 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -241,7 +241,7 @@ $(document).ready(function() {
$("#sqlqueryform.ajax").live('submit', function(event) {
event.preventDefault();
- $form = $(this);
+ var $form = $(this);
if (! checkSqlQuery($form[0])) {
return false;
}
@@ -250,11 +250,12 @@ $(document).ready(function() {
$('.error').remove();
var $msgbox = PMA_ajaxShowMessage();
+ var $sqlqueryresults = $('#sqlqueryresults');
PMA_prepareForAjaxRequest($form);
- $.post($(this).attr('action'), $(this).serialize() , function(data) {
- if(data.success == true) {
+ $.post($form.attr('action'), $form.serialize() , function(data) {
+ if (data.success == true) {
// fade out previous messages, if any
$('.success').fadeOut();
$('.sqlquery_message').fadeOut();
@@ -268,7 +269,7 @@ $(document).ready(function() {
} else {
$('#sqlqueryform').before(data.message);
}
- $('#sqlqueryresults').show();
+ $sqlqueryresults.show();
// this happens if a USE command was typed
if (typeof data.reload != 'undefined') {
// Unbind the submit event before reloading. See bug #3295529
@@ -285,25 +286,25 @@ $(document).ready(function() {
else if (data.success == false ) {
// show an error message that stays on screen
$('#sqlqueryform').before(data.error);
- $('#sqlqueryresults').hide();
+ $sqlqueryresults.hide();
}
else {
// real results are returned
// fade out previous messages, if any
$('.success').fadeOut();
$('.sqlquery_message').fadeOut();
- $received_data = $(data);
- $zero_row_results = $received_data.find('textarea[name="sql_query"]');
+ var $received_data = $(data);
+ var $zero_row_results = $received_data.find('textarea[name="sql_query"]');
// if zero rows are returned from the query execution
if ($zero_row_results.length > 0) {
$('#sqlquery').val($zero_row_results.val());
} else {
- $('#sqlqueryresults').show();
- $("#sqlqueryresults").html(data);
- $("#sqlqueryresults").trigger('appendAnchor');
- $("#sqlqueryresults").trigger('makegrid');
+ $sqlqueryresults.show();
+ $sqlqueryresults.html(data);
+ $sqlqueryresults.trigger('appendAnchor');
+ $sqlqueryresults.trigger('makegrid');
$('#togglequerybox').show();
- if($("#togglequerybox").siblings(":visible").length > 0) {
+ if ($("#togglequerybox").siblings(":visible").length > 0) {
$("#togglequerybox").trigger('click');
}
PMA_init_slider();
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-9532-ga463231
by Michal Čihař 19 Jul '11
by Michal Čihař 19 Jul '11
19 Jul '11
The branch, master has been updated
via a463231e0ff89ea8e433a266c72427dfc40d6965 (commit)
via 38799f3e65d6faf04a4edfb894bd53e4ae0e9ddb (commit)
via 3985519a006927f4a139110155e99d1e4b7bc47e (commit)
via 3bae46852593f4baf32d7797c2e5beb7c687611e (commit)
via 984c50f02eccc3cf49509cd921ba4b5b570dd602 (commit)
via 2689839996811146436891a6157abaaebbd60c05 (commit)
via 05622d032d063efdcb69a7af1a09a02b497bcde2 (commit)
via cc71d547a157172e25f09e16c1153776bebacd23 (commit)
via bad941efb35acb738e52a5728f25a028f373e73b (commit)
via 01efea0f1d671f0347ba6abd043745c64ec50a01 (commit)
via 459652bd0c01dd6d5ceab5672bfc739aac2c7183 (commit)
via 8aabb53a2f27060f32ffbd2c2ab87ca35dfeefe6 (commit)
via fed7f0a5328aa71547703a6ee8eb7e8bbc6a4f5a (commit)
via 422ff71de44efb3645ee604650e10ed40eee7490 (commit)
via 890dcfacc2320c4d19a2dd7912763ee461d52923 (commit)
via 8e20fc65a90297236e126ea2af814729dd964bbd (commit)
via 3b2503ffbcb469164bcbc145f2973b8381038a1c (commit)
via 31d0a0628344ae7032ac0cb4e73134d4b6e3687b (commit)
via 487c68c698b42868175b85c2e5e6ec620e0ae31c (commit)
via fc5d56017b0b61cf1346b074d043e76c7171d611 (commit)
via 09af7267e3672bf24812e5ade472219bb8be7f71 (commit)
via fcacd3bcb8ecdf4647504881d447329d31672bd0 (commit)
via 3d00126440de97bda2a8c9704f52f2b6ff0c3dc6 (commit)
via cadb7a42fde43c8aa4db41ea389a40e3b6b4a6db (commit)
via df24314a70d43faaa650218c9ad6904a630530e2 (commit)
via b78c2127f207b877d233ba5f66b80854799709c7 (commit)
via 6d1038fc3d45b921e9b420c14b4c7bee41db34a5 (commit)
via 8a26036b7783cea59ac02301b498d12e08ecde27 (commit)
via e5fbec3fbd2a0e6733b10709af20e9fe3ad3de9e (commit)
via dbe3dee5e0da5fc03dd82036827cd2cc0cbe551d (commit)
via acf0b46242e351e4c94bee323edf6bc0c9b8bf9c (commit)
via a1b6766109df5cc9e9b4114b15941469bf7b7278 (commit)
via 94bce1d687890d350594ba5ef1bcbabbc1c3fc2a (commit)
via e51bf0effab6db48263175a75eac5261bbe21b7b (commit)
via 72a19b0a8355601576a0c3d86723fd75a3a46494 (commit)
via 1d85faee1a1ac0db40f762ea45f99ab5edfd4acb (commit)
via fe6611f05bd3f5b9dd774ad1a43ffaed0280be01 (commit)
via 8667d0f4a98ec44e0dda550260be545d2a8b908b (commit)
via 1b26815ed662f9e522b5a465cfe425dd9111d82c (commit)
via bdcbb35d3d32317d3b6df5cba07637bee62d5baf (commit)
from 56f55dcaf69ee60889ba6c7fef9921daf17bc3de (commit)
- Log -----------------------------------------------------------------
commit a463231e0ff89ea8e433a266c72427dfc40d6965
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:45:11 2011 +0200
Translation update done using Pootle.
commit 38799f3e65d6faf04a4edfb894bd53e4ae0e9ddb
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:44:54 2011 +0200
Translation update done using Pootle.
commit 3985519a006927f4a139110155e99d1e4b7bc47e
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:44:29 2011 +0200
Translation update done using Pootle.
commit 3bae46852593f4baf32d7797c2e5beb7c687611e
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:44:18 2011 +0200
Translation update done using Pootle.
commit 984c50f02eccc3cf49509cd921ba4b5b570dd602
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:44:01 2011 +0200
Translation update done using Pootle.
commit 2689839996811146436891a6157abaaebbd60c05
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:43:48 2011 +0200
Translation update done using Pootle.
commit 05622d032d063efdcb69a7af1a09a02b497bcde2
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:43:40 2011 +0200
Translation update done using Pootle.
commit cc71d547a157172e25f09e16c1153776bebacd23
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:43:33 2011 +0200
Translation update done using Pootle.
commit bad941efb35acb738e52a5728f25a028f373e73b
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:43:24 2011 +0200
Translation update done using Pootle.
commit 01efea0f1d671f0347ba6abd043745c64ec50a01
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:43:15 2011 +0200
Translation update done using Pootle.
commit 459652bd0c01dd6d5ceab5672bfc739aac2c7183
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:43:06 2011 +0200
Translation update done using Pootle.
commit 8aabb53a2f27060f32ffbd2c2ab87ca35dfeefe6
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:42:55 2011 +0200
Translation update done using Pootle.
commit fed7f0a5328aa71547703a6ee8eb7e8bbc6a4f5a
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:42:42 2011 +0200
Translation update done using Pootle.
commit 422ff71de44efb3645ee604650e10ed40eee7490
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:42:33 2011 +0200
Translation update done using Pootle.
commit 890dcfacc2320c4d19a2dd7912763ee461d52923
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:42:14 2011 +0200
Translation update done using Pootle.
commit 8e20fc65a90297236e126ea2af814729dd964bbd
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:41:59 2011 +0200
Translation update done using Pootle.
commit 3b2503ffbcb469164bcbc145f2973b8381038a1c
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:41:52 2011 +0200
Translation update done using Pootle.
commit 31d0a0628344ae7032ac0cb4e73134d4b6e3687b
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:41:29 2011 +0200
Translation update done using Pootle.
commit 487c68c698b42868175b85c2e5e6ec620e0ae31c
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:41:11 2011 +0200
Translation update done using Pootle.
commit fc5d56017b0b61cf1346b074d043e76c7171d611
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:41:01 2011 +0200
Translation update done using Pootle.
commit 09af7267e3672bf24812e5ade472219bb8be7f71
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:40:48 2011 +0200
Translation update done using Pootle.
commit fcacd3bcb8ecdf4647504881d447329d31672bd0
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:40:34 2011 +0200
Translation update done using Pootle.
commit 3d00126440de97bda2a8c9704f52f2b6ff0c3dc6
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:39:43 2011 +0200
Translation update done using Pootle.
commit cadb7a42fde43c8aa4db41ea389a40e3b6b4a6db
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:39:28 2011 +0200
Translation update done using Pootle.
commit df24314a70d43faaa650218c9ad6904a630530e2
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:39:21 2011 +0200
Translation update done using Pootle.
commit b78c2127f207b877d233ba5f66b80854799709c7
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:39:12 2011 +0200
Translation update done using Pootle.
commit 6d1038fc3d45b921e9b420c14b4c7bee41db34a5
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:39:01 2011 +0200
Translation update done using Pootle.
commit 8a26036b7783cea59ac02301b498d12e08ecde27
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:38:55 2011 +0200
Translation update done using Pootle.
commit e5fbec3fbd2a0e6733b10709af20e9fe3ad3de9e
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:38:40 2011 +0200
Translation update done using Pootle.
commit dbe3dee5e0da5fc03dd82036827cd2cc0cbe551d
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:38:06 2011 +0200
Translation update done using Pootle.
commit acf0b46242e351e4c94bee323edf6bc0c9b8bf9c
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:38:00 2011 +0200
Translation update done using Pootle.
commit a1b6766109df5cc9e9b4114b15941469bf7b7278
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:37:37 2011 +0200
Translation update done using Pootle.
commit 94bce1d687890d350594ba5ef1bcbabbc1c3fc2a
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:37:17 2011 +0200
Translation update done using Pootle.
commit e51bf0effab6db48263175a75eac5261bbe21b7b
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:36:11 2011 +0200
Translation update done using Pootle.
commit 72a19b0a8355601576a0c3d86723fd75a3a46494
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:35:56 2011 +0200
Translation update done using Pootle.
commit 1d85faee1a1ac0db40f762ea45f99ab5edfd4acb
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:35:33 2011 +0200
Translation update done using Pootle.
commit fe6611f05bd3f5b9dd774ad1a43ffaed0280be01
Merge: 8667d0f4a98ec44e0dda550260be545d2a8b908b 56f55dcaf69ee60889ba6c7fef9921daf17bc3de
Author: Pootle server <pootle(a)cihar.com>
Date: Tue Jul 19 14:34:56 2011 +0200
Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
Conflicts:
po/da.po
commit 8667d0f4a98ec44e0dda550260be545d2a8b908b
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:34:41 2011 +0200
Translation update done using Pootle.
commit 1b26815ed662f9e522b5a465cfe425dd9111d82c
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:34:27 2011 +0200
Translation update done using Pootle.
commit bdcbb35d3d32317d3b6df5cba07637bee62d5baf
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:34:19 2011 +0200
Translation update done using Pootle.
-----------------------------------------------------------------------
Summary of changes:
po/da.po | 75 ++++++++++++++++++++++++++++---------------------------------
1 files changed, 34 insertions(+), 41 deletions(-)
diff --git a/po/da.po b/po/da.po
index 744d39c..ef57913 100644
--- a/po/da.po
+++ b/po/da.po
@@ -3,8 +3,8 @@ msgid ""
msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel(a)lists.sourceforge.net\n"
-"POT-Creation-Date: 2011-07-19 14:25+0200\n"
-"PO-Revision-Date: 2011-07-19 14:33+0200\n"
+"POT-Creation-Date: 2011-07-14 18:39+0200\n"
+"PO-Revision-Date: 2011-07-19 14:45+0200\n"
"Last-Translator: <opensource(a)jth.net>\n"
"Language-Team: danish <da(a)li.org>\n"
"Language: da\n"
@@ -6044,7 +6044,7 @@ msgstr "Views"
#: libraries/export/xml.php:47
msgid "Export contents"
-msgstr ""
+msgstr "Eksport indhold"
#: libraries/footer.inc.php:163 libraries/footer.inc.php:166
#: libraries/footer.inc.php:169
@@ -6053,7 +6053,7 @@ msgstr "Åbn nyt phpMyAdmin vindue"
#: libraries/gis_visualization.lib.php:129
msgid "No data found for GIS visualization."
-msgstr ""
+msgstr "Ingen data fundet for GIS visualization"
#: libraries/header_printview.inc.php:49 libraries/header_printview.inc.php:54
msgid "SQL result"
@@ -10769,46 +10769,45 @@ msgstr "Data dump for tabellen"
#: tbl_operations.php:692
msgid "Empty the table (TRUNCATE)"
-msgstr ""
+msgstr "Tøm tabellen (TRUNCATE)"
#: tbl_operations.php:712
-#, fuzzy
#| msgid "Copy database to"
msgid "Delete the table (DROP)"
-msgstr "Kopiér database til"
+msgstr "Slet tabellen (DROP)"
#: tbl_operations.php:733
msgid "Partition maintenance"
-msgstr ""
+msgstr "Vedligehold af partition"
#: tbl_operations.php:741
#, php-format
msgid "Partition %s"
-msgstr ""
+msgstr "Partition %s"
#: tbl_operations.php:744
msgid "Analyze"
-msgstr ""
+msgstr "Analyser"
#: tbl_operations.php:745
msgid "Check"
-msgstr ""
+msgstr "Check"
#: tbl_operations.php:746
msgid "Optimize"
-msgstr ""
+msgstr "Optimer"
#: tbl_operations.php:747
msgid "Rebuild"
-msgstr ""
+msgstr "Genopbyg"
#: tbl_operations.php:748
msgid "Repair"
-msgstr ""
+msgstr "Reparer"
#: tbl_operations.php:760
msgid "Remove partitioning"
-msgstr ""
+msgstr "Fjern partitionering"
#: tbl_operations.php:786
msgid "Check referential integrity:"
@@ -10836,7 +10835,7 @@ msgstr "Række-statistik"
#: tbl_printview.php:377 tbl_structure.php:873
msgid "static"
-msgstr ""
+msgstr "statisk"
#: tbl_printview.php:379 tbl_structure.php:875
msgid "dynamic"
@@ -10856,10 +10855,9 @@ msgid "Error creating foreign key on %1$s (check data types)"
msgstr ""
#: tbl_relation.php:402
-#, fuzzy
#| msgid "Internal relations"
msgid "Internal relation"
-msgstr "Interne relationer"
+msgstr "Intern relation"
#: tbl_relation.php:404
msgid ""
@@ -10887,7 +10885,7 @@ msgstr "Tilføj søgekriterier (kroppen af \"WHERE\" sætningen):"
#: tbl_select.php:285
msgid "Number of rows per page"
-msgstr "poster pr. side"
+msgstr "Rækker pr. side"
#: tbl_select.php:291
msgid "Display order:"
@@ -10903,7 +10901,7 @@ msgstr "Gennemse bestemte værdier"
#: tbl_structure.php:170 tbl_structure.php:171
msgid "Add primary key"
-msgstr ""
+msgstr "Tilføj primær nøgle"
#: tbl_structure.php:172 tbl_structure.php:173
msgid "Add index"
@@ -10922,17 +10920,16 @@ msgid "Add FULLTEXT index"
msgstr ""
#: tbl_structure.php:391
-#, fuzzy
#| msgid "None"
msgctxt "None for default"
msgid "None"
msgstr "Ingen"
#: tbl_structure.php:404
-#, fuzzy, php-format
+#, php-format
#| msgid "Table %s has been dropped"
msgid "Column %s has been dropped"
-msgstr "Tabel %s er slettet"
+msgstr "Kolonne %s er slettet"
#: tbl_structure.php:415 tbl_structure.php:509
#, php-format
@@ -10961,10 +10958,9 @@ msgid "Propose table structure"
msgstr "Foreslå tabelstruktur"
#: tbl_structure.php:676
-#, fuzzy
#| msgid "Add %s field(s)"
msgid "Add column"
-msgstr "Tilføj %s felt(er)"
+msgstr "Tilføj kolonne"
#: tbl_structure.php:690
msgid "At End of Table"
@@ -11022,7 +11018,7 @@ msgstr ""
#: tbl_tracking.php:215
msgid "Comment out these two lines if you do not need them."
-msgstr ""
+msgstr "Udkommenter disse to linjer, hvis du ikke har brug for dem."
#: tbl_tracking.php:224
msgid "SQL statements exported. Please copy the dump or execute it."
@@ -11038,10 +11034,9 @@ msgid "Tracking data definition successfully deleted"
msgstr "Sporing af data definition slettet"
#: tbl_tracking.php:384 tbl_tracking.php:401
-#, fuzzy
#| msgid "Query type"
msgid "Query error"
-msgstr "Forespørgselstype"
+msgstr "Forespørgselsfejl"
#: tbl_tracking.php:399
msgid "Tracking data manipulation successfully deleted"
@@ -11057,32 +11052,30 @@ msgid "Show %s with dates from %s to %s by user %s %s"
msgstr ""
#: tbl_tracking.php:432
-#, fuzzy
#| msgid "Allows inserting and replacing data."
msgid "Delete tracking data row from report"
-msgstr "Tillader indsættelse og erstatning af data."
+msgstr "Slet sporingsdatarække fra rapport"
#: tbl_tracking.php:443
-#, fuzzy
#| msgid "No databases"
msgid "No data"
-msgstr "Ingen databaser"
+msgstr "Ingen data"
#: tbl_tracking.php:453 tbl_tracking.php:510
msgid "Date"
-msgstr ""
+msgstr "Dato"
#: tbl_tracking.php:455
msgid "Data definition statement"
-msgstr ""
+msgstr "Datadefinitionsudstryk"
#: tbl_tracking.php:512
msgid "Data manipulation statement"
-msgstr ""
+msgstr "Data manipuleringsudtryk"
#: tbl_tracking.php:558
msgid "SQL dump (file download)"
-msgstr ""
+msgstr "SQL-udtræk (hentning af fil)"
#: tbl_tracking.php:559
msgid "SQL dump"
@@ -11112,7 +11105,7 @@ msgstr "Version"
#: tbl_tracking.php:692
#, php-format
msgid "Deactivate tracking for %s.%s"
-msgstr "Deaktiver tracking af %s.%s"
+msgstr "Deaktiver sporing af %s.%s"
#: tbl_tracking.php:694
msgid "Deactivate now"
@@ -11121,7 +11114,7 @@ msgstr "Deaktiver nu"
#: tbl_tracking.php:705
#, php-format
msgid "Activate tracking for %s.%s"
-msgstr "Aktiver tracking af %s.%s"
+msgstr "Aktiver sporing af %s.%s"
#: tbl_tracking.php:707
msgid "Activate now"
@@ -11133,12 +11126,13 @@ msgid "Create version %s of %s.%s"
msgstr "Opret version %s af %s.%s"
#: tbl_tracking.php:724
+#, fuzzy
msgid "Track these data definition statements:"
-msgstr "Spor disse data definition udsagn"
+msgstr "Spor disse datadefinitions-udsagn:"
#: tbl_tracking.php:732
msgid "Track these data manipulation statements:"
-msgstr "Spor disse data manipulation udsagn:"
+msgstr "Spor disse datamanipulations-forespørgsler:"
#: tbl_tracking.php:740
msgid "Create version"
@@ -11172,7 +11166,6 @@ msgid "Available transformations"
msgstr "Tilgængelige transformationer"
#: transformation_overview.php:47
-#, fuzzy
#| msgid "Description"
msgctxt "for MIME transformation"
msgid "Description"
hooks/post-receive
--
phpMyAdmin
1
0

[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-9492-g56f55dc
by Michal Čihař 19 Jul '11
by Michal Čihař 19 Jul '11
19 Jul '11
The branch, master has been updated
via 56f55dcaf69ee60889ba6c7fef9921daf17bc3de (commit)
via 860bacccbf3177fd9ff4ea228ba47408dc75cd85 (commit)
via 575e4a0d37e379e5f6f2c6f3c6cca0c032bb1e05 (commit)
via e8a8c7e2bcbb36055cec8c7fc60d469b6dd3f043 (commit)
from aa129ac3551cfa576863c310bd1f83537a958e0a (commit)
- Log -----------------------------------------------------------------
commit 56f55dcaf69ee60889ba6c7fef9921daf17bc3de
Merge: aa129ac3551cfa576863c310bd1f83537a958e0a 860bacccbf3177fd9ff4ea228ba47408dc75cd85
Author: Michal Čihař <mcihar(a)suse.cz>
Date: Tue Jul 19 14:35:04 2011 +0200
Merge remote-tracking branch 'pootle/master'
Conflicts:
po/da.po
commit 860bacccbf3177fd9ff4ea228ba47408dc75cd85
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:33:48 2011 +0200
Translation update done using Pootle.
commit 575e4a0d37e379e5f6f2c6f3c6cca0c032bb1e05
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:33:00 2011 +0200
Translation update done using Pootle.
commit e8a8c7e2bcbb36055cec8c7fc60d469b6dd3f043
Author: opensource <opensource(a)jth.net>
Date: Tue Jul 19 14:32:25 2011 +0200
Translation update done using Pootle.
-----------------------------------------------------------------------
Summary of changes:
po/da.po | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/po/da.po b/po/da.po
index f8aea36..744d39c 100644
--- a/po/da.po
+++ b/po/da.po
@@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel(a)lists.sourceforge.net\n"
"POT-Creation-Date: 2011-07-19 14:25+0200\n"
-"PO-Revision-Date: 2011-07-19 14:31+0200\n"
+"PO-Revision-Date: 2011-07-19 14:33+0200\n"
"Last-Translator: <opensource(a)jth.net>\n"
"Language-Team: danish <da(a)li.org>\n"
"Language: da\n"
@@ -5923,16 +5923,15 @@ msgstr ""
#: libraries/export/sql.php:107 libraries/export/sql.php:162
#: libraries/export/sql.php:167
-#, fuzzy, php-format
+#, php-format
#| msgid "Statements"
msgid "Add %s statement"
-msgstr "Erklæringer"
+msgstr "Tilføj %s forespørgsel"
#: libraries/export/sql.php:145
-#, fuzzy
#| msgid "Statements"
msgid "Add statements:"
-msgstr "Erklæringer"
+msgstr "Tilføj forespørgsler"
#: libraries/export/sql.php:197
msgid ""
@@ -6039,10 +6038,9 @@ msgid "Object creation options (all are recommended)"
msgstr ""
#: libraries/export/xml.php:40
-#, fuzzy
#| msgid "View"
msgid "Views"
-msgstr "Visning"
+msgstr "Views"
#: libraries/export/xml.php:47
msgid "Export contents"
hooks/post-receive
--
phpMyAdmin
1
0