Merge branch 'master' of https://github.com/phpmyadmin/phpmyadmin into mult_submit_refactor

This commit is contained in:
xmujay 2013-08-16 13:49:10 +08:00
commit 230f5c7103
37 changed files with 5220 additions and 745 deletions

View File

@ -19,13 +19,13 @@
</target>
<target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
<exec executable="phpunit">
<exec executable="phpunit" failonerror="true">
<arg line="--configuration phpunit.xml.dist"/>
</exec>
</target>
<target name="phpunit-nocoverage" description="Run unit tests using PHPUnit and generates junit.xml">
<exec executable="phpunit">
<exec executable="phpunit" failonerror="true">
<arg line="--configuration phpunit.xml.nocoverage"/>
</exec>
</target>

View File

@ -1173,10 +1173,10 @@ Generic settings
.. config:option:: $cfg['MemoryLimit']
:type: string [number of bytes]
:default: ``'0'``
:default: ``'-1'``
Set the number of bytes a script is allowed to allocate. If set to
zero, no limit is imposed.
``'-1'``, no limit is imposed.
This setting is used while importing/exporting dump files and at some other
places in phpMyAdmin so you definitely don't want to put here a too low

View File

@ -1828,8 +1828,8 @@ t/pma/Charts#Data_formats_for_query_results_chart>`_.
.. _faq6_30:
6.30 Import: How can I import ESRI Shapefiles
---------------------------------------------
6.30 Import: How can I import ESRI Shapefiles?
----------------------------------------------
An ESRI Shapefile is actually a set of several files, where .shp file
contains geometry data and .dbf file contains data related to those

View File

@ -1512,12 +1512,28 @@ class PMA_DatabaseInterface
// Skip charsets for Drizzle
if (!PMA_DRIZZLE) {
if (PMA_MYSQL_INT_VERSION > 50503) {
$default_charset = 'utf8mb4';
$default_collation = 'utf8mb4_general_ci';
} else {
$default_charset = 'utf8';
$default_collation = 'utf8_general_ci';
}
if (! empty($GLOBALS['collation_connection'])) {
$this->query(
"SET CHARACTER SET 'utf8';",
"SET CHARACTER SET '$default_charset';",
$link,
self::QUERY_STORE
);
/* Automatically adjust collation to mb4 variant */
if ($default_charset == 'utf8mb4'
&& strncmp('utf8_', $GLOBALS['collation_connection'], 5) == 0
) {
$GLOBALS['collation_connection'] = 'utf8mb4_' . substr(
$GLOBALS['collation_connection'],
5
);
}
$set_collation_con_query = "SET collation_connection = '"
. PMA_Util::sqlAddSlashes($GLOBALS['collation_connection'])
. "';";
@ -1528,7 +1544,7 @@ class PMA_DatabaseInterface
);
} else {
$this->query(
"SET NAMES 'utf8' COLLATE 'utf8_general_ci';",
"SET NAMES '$default_charset' COLLATE '$default_collation';",
$link,
self::QUERY_STORE
);

View File

@ -705,13 +705,13 @@ $cfg['ExecTimeLimit'] = 300;
$cfg['SessionSavePath'] = '';
/**
* maximum allocated bytes ('0' for no limit)
* maximum allocated bytes ('-1' for no limit)
* this is a string because '16M' is a valid value; we must put here
* a string as the default value so that /setup accepts strings
*
* @global string $cfg['MemoryLimit']
*/
$cfg['MemoryLimit'] = '0';
$cfg['MemoryLimit'] = '-1';
/**
* mark used tables, make possible to show locked tables (since MySQL 3.23.30)

View File

@ -177,7 +177,7 @@ class PMA_Validator
ini_set('html_errors', false);
ini_set('track_errors', true);
ini_set('display_errors', true);
set_error_handler("PMA_Validator", "nullErrorHandler");
set_error_handler(array("PMA_Validator", "nullErrorHandler"));
ob_start();
} else {
ob_end_clean();

View File

@ -58,7 +58,7 @@ function PMA_getIndexedColumns()
* according to the request
*/
function PMA_buildColumnCreationStatement(
$field_cnt, $field_primary, $is_create_tbl = true
$field_cnt, &$field_primary, $is_create_tbl = true
) {
$definitions = array();
for ($i = 0; $i < $field_cnt; ++$i) {

View File

@ -430,7 +430,7 @@ class ExportTexytext extends ExportPlugin
*/
function getTriggers($db, $table)
{
$text_output .= "|------\n";
$text_output = "|------\n";
$text_output .= '|' . __('Column');
$dump = "|------\n";
$dump .= '|' . __('Name');

View File

@ -2577,4 +2577,41 @@ function PMA_getReservedWordColumnNameMessages($db ,$table)
}
return $messages;
}
/**
* Function to get the type of command for multiple field handling
*
* @return string
*/
function PMA_getMultipleFieldCommandType()
{
$submit_mult = null;
if (isset($_REQUEST['submit_mult_change_x'])) {
$submit_mult = 'change';
} elseif (isset($_REQUEST['submit_mult_drop_x'])) {
$submit_mult = 'drop';
} elseif (isset($_REQUEST['submit_mult_primary_x'])) {
$submit_mult = 'primary';
} elseif (isset($_REQUEST['submit_mult_index_x'])) {
$submit_mult = 'index';
} elseif (isset($_REQUEST['submit_mult_unique_x'])) {
$submit_mult = 'unique';
} elseif (isset($_REQUEST['submit_mult_spatial_x'])) {
$submit_mult = 'spatial';
} elseif (isset($_REQUEST['submit_mult_fulltext_x'])) {
$submit_mult = 'ftext';
} elseif (isset($_REQUEST['submit_mult_browse_x'])) {
$submit_mult = 'browse';
} elseif (isset($_REQUEST['submit_mult'])) {
$submit_mult = $_REQUEST['submit_mult'];
} elseif (isset($_REQUEST['mult_btn']) && $_REQUEST['mult_btn'] == __('Yes')) {
$submit_mult = 'row_delete';
if (isset($_REQUEST['selected'])) {
$_REQUEST['selected_fld'] = $_REQUEST['selected'];
}
}
return $submit_mult;
}
?>

View File

@ -37,7 +37,6 @@ require_once './libraries/tbl_columns_definition_form.lib.php';
* Initialize $html in case this variable was used by a caller
* (yes, this script should be refactored into functions)
*/
$html = '';
$length_values_input_size = 8;
@ -51,9 +50,6 @@ $is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php');
require_once './libraries/transformations.lib.php';
$cfgRelation = PMA_getRelationsParam();
$comments_map = array();
$mime_map = array();
$available_mime = array();
$comments_map = PMA_getComments($db, $table);
@ -102,16 +98,13 @@ for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) {
$columnMeta['Default']
= PMA_Util::convertBitDefaultValue($columnMeta['Default']);
}
}
if (empty($columnMeta['Type'])) {
$type = $extracted_columnspec['type'];
$length = $extracted_columnspec['spec_in_brackets'];
} else {
// creating a column
$columnMeta['Type'] = '';
$type = '';
$length = '';
} else {
$type = $extracted_columnspec['type'];
$length = $extracted_columnspec['spec_in_brackets'];
}
// some types, for example longtext, are reported as
@ -121,34 +114,24 @@ for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) {
if ($tmp) {
$type = substr($type, 0, $tmp - 1);
}
// rtrim the type, for cases like "float unsigned"
$type = rtrim($type);
if (isset($submit_length) && $submit_length != false) {
$length = $submit_length;
}
// rtrim the type, for cases like "float unsigned"
$type = rtrim($type);
$type_upper = strtoupper($type);
// old column attributes
if ($is_backup) {
if (isset($columnMeta['Field'])) {
$_form_params['field_orig[' . $columnNumber . ']']
= $columnMeta['Field'];
} else {
$_form_params['field_orig[' . $columnNumber . ']'] = '';
}
// old column length
$_form_params['field_length_orig[' . $columnNumber . ']'] = $length;
// old column default
$_form_params['field_default_orig[' . $columnNumber . ']']
= (isset($columnMeta['Default']) ? $columnMeta['Default'] : '');
$_form_params = PMA_getFormParamsForOldColumn(
$columnMeta, $length, $_form_params
);
}
$content_cells[$columnNumber] = PMA_getHtmlForColumnAttributes(
$columnNumber, isset($columnMeta) ? $columnMeta : null, $type_upper,
$columnNumber, isset($columnMeta) ? $columnMeta : null, strtoupper($type),
$length_values_input_size, $length,
isset($default_current_timestamp) ? $default_current_timestamp : null,
isset($extracted_columnspec) ? $extracted_columnspec : null,
@ -162,44 +145,7 @@ for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) {
);
} // end for
/**
* needs to be finished
*
*
if ($display_type == 'horizontal') {
$new_field = '';
foreach ($empty_row as $content_row_val) {
$new_field .= '<td class="center">' . $content_row_val . '</td>';
}
?>
<script type="text/javascript">
// <![CDATA[
var odd_row = <?php echo $odd_row; ?>;
function addField()
{
var new_fields = document.getElementById('added_fields').value;
var new_field_container = document.getElementById('table_columns');
var new_field = '<?php echo preg_replace('|\s+|', ' ', preg_replace('|\'|', '\\\'', $new_field)); ?>';
var i = 0;
for (i = 0; i < new_fields; i++) {
if (odd_row) {
new_field_container.innerHTML += '<tr class="odd">' + new_field + '</tr>';
} else {
new_field_container.innerHTML += '<tr class="even">' + new_field + '</tr>';
}
odd_row = ! odd_row;
}
return true;
}
// ]]>
</script>
<?php
}
*/
$html .= PMA_getHtmlForTableCreateOrAddField(
$html = PMA_getHtmlForTableCreateOrAddField(
$action, $_form_params, $content_cells, $header_cells
);

View File

@ -1261,4 +1261,31 @@ function PMA_getHtmlForColumnAttributes($columnNumber, $columnMeta, $type_upper,
return $content_cell;
}
/**
* Function to get form parameters for old column
*
* @param array $columnMeta column meta
* @param int $length length
* @param array $form_params form parameters
*
* @return array
*/
function PMA_getFormParamsForOldColumn($columnMeta, $length, $form_params)
{
if (isset($columnMeta['Field'])) {
$form_params['field_orig[' . $columnNumber . ']']
= $columnMeta['Field'];
} else {
$form_params['field_orig[' . $columnNumber . ']'] = '';
}
// old column length
$form_params['field_length_orig[' . $columnNumber . ']'] = $length;
// old column default
$form_params['field_default_orig[' . $columnNumber . ']']
= (isset($columnMeta['Default']) ? $columnMeta['Default'] : '');
return $form_params;
}
?>

View File

@ -21,8 +21,7 @@ if (isset($_POST['scale']) && ! PMA_isValid($_POST['scale'], 'numeric')) {
*/
$post_params = array(
'db',
'mode',
'scale'
'mode'
);
foreach ($post_params as $one_post_param) {
@ -34,7 +33,7 @@ foreach ($post_params as $one_post_param) {
/**
* If called directly from the designer, first save the positions
*/
if (! isset($scale)) {
if (! isset($_POST['scale'])) {
include_once 'pmd_save_pos.php';
}
@ -47,7 +46,7 @@ if (isset($mode)) {
. PMA_Util::backquote($GLOBALS['cfgRelation']['designer_coords']);
$pma_table = PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.'
. PMA_Util::backquote($cfgRelation['table_coords']);
$scale_q = PMA_Util::sqlAddSlashes($scale);
$scale_q = PMA_Util::sqlAddSlashes($_POST['scale']);
if ('create_export' == $mode) {
$pdf_page_number = PMA_REL_createPage($_POST['newpage'], $cfgRelation, $db);

444
po/bn.po

File diff suppressed because it is too large Load Diff

View File

@ -4,10 +4,9 @@ msgstr ""
"Project-Id-Version: phpMyAdmin-docs 4.0.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-08-11 13:17+0200\n"
"PO-Revision-Date: 2013-08-01 14:19+0200\n"
"Last-Translator: Michal Čihař <michal@cihar.com>\n"
"Language-Team: French <http://l10n.cihar.com/projects/phpmyadmin/master/fr/"
">\n"
"PO-Revision-Date: 2013-08-12 14:40+0200\n"
"Last-Translator: Marc Delisle <marc@infomarc.info>\n"
"Language-Team: French <http://l10n.cihar.com/projects/phpmyadmin/master/fr/>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -914,7 +913,7 @@ msgstr "La commande «DROP DATABASE» est désactivée."
#: js/messages.php:35
msgid "Confirm"
msgstr ""
msgstr "Confirmer"
#: js/messages.php:36
#, php-format
@ -946,10 +945,10 @@ msgid "This operation could take a long time. Proceed anyway?"
msgstr "Cette opération pourrait être longue. Procéder quand même ?"
#: js/messages.php:44
#, fuzzy, php-format
#, php-format
#| msgid "Do you really want to execute \"%s\"?"
msgid "Do you really want to delete user group \"%s\"?"
msgstr "Voulez-vous vraiment exécuter «%s» ?"
msgstr "Voulez-vous vraiment supprimer le groupe «%s» ?"
#: js/messages.php:47
msgid "Missing value in the form!"
@ -6971,7 +6970,6 @@ msgid "%s of %s"
msgstr "%s sur %s"
#: libraries/display_import.lib.php:454
#, fuzzy
#| msgid "Uploading your import file..."
msgid "Uploading your import file…"
msgstr "Téléversement du fichier d'importation en cours …"
@ -10375,19 +10373,16 @@ msgid "User groups"
msgstr "Groupes d'utilisateurs"
#: libraries/server_privileges.lib.php:3268
#, fuzzy
#| msgid "Server-level tabs"
msgid "Server level tabs"
msgstr "Onglets de niveau serveur"
#: libraries/server_privileges.lib.php:3269
#, fuzzy
#| msgid "Database-level tabs"
msgid "Database level tabs"
msgstr "Onglets de niveau base de données"
#: libraries/server_privileges.lib.php:3270
#, fuzzy
#| msgid "Table-level tabs"
msgid "Table level tabs"
msgstr "Onglets de niveau table"
@ -12625,7 +12620,7 @@ msgstr ""
"disponibles sur ce serveur."
#: setup/lib/index.lib.php:226
#, fuzzy, php-format
#, php-format
#| msgid ""
#| "%sLogin cookie validity%s greater than 1440 seconds may cause random "
#| "session invalidation if %ssession.gc_maxlifetime%s is lower than its "
@ -12634,10 +12629,9 @@ msgid ""
"%sLogin cookie validity%s greater than %ssession.gc_maxlifetime%s may cause "
"random session invalidation (currently session.gc_maxlifetime is %d)."
msgstr ""
"Le paramètre %sLogin cookie validity%s avec une valeur de plus de 1440 "
"secondes peut causer des interruptions de la session de travail si le "
"paramètre %ssession.gc_maxlifetime%s a une plus petite valeur (actuellement "
"%d)."
"Le paramètre %sLogin cookie validity%s avec une valeur plus grande que celle "
"de %ssession.gc_maxlifetime%s peut causer des interruptions de la session "
"de travail (la valeur courante de session.gc_maxlifetime est de %d)."
#: setup/lib/index.lib.php:228
#, php-format

112
po/hu.po
View File

@ -4,16 +4,16 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-08-11 13:17+0200\n"
"PO-Revision-Date: 2013-07-30 14:37+0200\n"
"PO-Revision-Date: 2013-08-15 08:50+0200\n"
"Last-Translator: G. S. <somogyig@gmail.com>\n"
"Language-Team: Hungarian <http://l10n.cihar.com/projects/phpmyadmin/master/"
"hu/>\n"
"Language-Team: Hungarian "
"<http://l10n.cihar.com/projects/phpmyadmin/master/hu/>\n"
"Language: hu\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 1.6\n"
"X-Generator: Weblate 1.7-dev\n"
#: browse_foreigners.php:50 browse_foreigners.php:70 js/messages.php:348
#: libraries/DisplayResults.class.php:805
@ -693,10 +693,9 @@ msgid "Back"
msgstr "Vissza"
#: index.php:115 libraries/Footer.class.php:72
#, fuzzy
#| msgid "phpMyAdmin homepage"
msgid "phpMyAdmin Demo Server"
msgstr "phpMyAdmin honlap"
msgstr "phpMyAdmin Demo Server"
#: index.php:119
#, php-format
@ -705,6 +704,8 @@ msgid ""
"change root, debian-sys-maint and pma users. More information is available "
"at %s."
msgstr ""
"Ön demo szervert használ. Bármit szerkeszthet, de kérjük, ne változtasson "
"root, debian-sys-maint és pma felhasználók értékein. További információ: %s."
#: index.php:129
msgid "General Settings"
@ -910,7 +911,7 @@ msgstr "A \"DROP DATABASE\" utasítást letiltották."
#: js/messages.php:35
msgid "Confirm"
msgstr ""
msgstr "Megerősítés"
#: js/messages.php:36
#, php-format
@ -942,10 +943,10 @@ msgid "This operation could take a long time. Proceed anyway?"
msgstr "Ez a művelet sokáig eltarthat. Mindenképp folytatja?"
#: js/messages.php:44
#, fuzzy, php-format
#, php-format
#| msgid "Do you really want to execute \"%s\"?"
msgid "Do you really want to delete user group \"%s\"?"
msgstr "Valóban végre szeretné hajtani: „%s”?"
msgstr "Valóban törölni szeretné a következő felhasználói csoportot: \"%s\"?"
#: js/messages.php:47
msgid "Missing value in the form!"
@ -2828,13 +2829,12 @@ msgstr "A feltöltött fájl nem olvasható."
#: libraries/Footer.class.php:76
#, php-format
msgid "Currently running Git revision %1$s from the %2$s branch."
msgstr ""
msgstr "Jelenleg futtatott Git revízió %1$s a %2$s branchból."
#: libraries/Footer.class.php:83
#, fuzzy
#| msgid "Version information"
msgid "Git information missing!"
msgstr "Verziószám"
msgstr "Git információ hiányzik!"
#: libraries/Footer.class.php:163 libraries/Footer.class.php:167
#: libraries/Footer.class.php:170
@ -4712,10 +4712,9 @@ msgstr "Az idegen kulcsok ellenőrzésének letiltása"
#: libraries/config/messages.inc.php:126
#: libraries/plugins/export/ExportSql.class.php:154
#, fuzzy
#| msgid "Exporting rows from \"%s\" table"
msgid "Export views as tables"
msgstr "Sorok exportálása a \"%s\" táblából"
msgstr "Nézetek exportálása táblaként"
#: libraries/config/messages.inc.php:127 libraries/config/messages.inc.php:128
#: libraries/config/messages.inc.php:130 libraries/config/messages.inc.php:136
@ -6148,7 +6147,6 @@ msgid "User groups table"
msgstr "Felhasználói csoport tábla"
#: libraries/config/messages.inc.php:460
#, fuzzy
#| msgid ""
#| "Leave blank for no user preferences storage in database, suggested: "
#| "[kbd]pma__userconfig[/kbd]"
@ -6156,12 +6154,12 @@ msgid ""
"Leave blank to disable the feature to hide and show navigation items, "
"suggested: [kbd]pma__navigationhiding[/kbd]"
msgstr ""
"Hagyja üresen, ha nincs szükség a felhasználói beállítások tárolására az "
"adatbázisban, ajánlott: [kbd]pma_history[/kbd]"
"Hagyja üresen, ha nincs szükség a navigációs elemek mutatása/elrejtése "
"opcióra, ajánlott: [kbd]pma__navigationhiding[/kbd]"
#: libraries/config/messages.inc.php:461
msgid "Hidden navigation items table"
msgstr ""
msgstr "Rejtett navigációs elemek tábla"
#: libraries/config/messages.inc.php:463
msgid "User for config auth"
@ -6959,7 +6957,6 @@ msgid "%s of %s"
msgstr "%s %s-ból/ből"
#: libraries/display_import.lib.php:454
#, fuzzy
#| msgid "Uploading your import file…"
msgid "Uploading your import file…"
msgstr "Az importfájl feltöltése…"
@ -7733,34 +7730,29 @@ msgid "An error has occured while loading the navigation tree"
msgstr "Hiba történt a navigációs faszerkezet megnyitása során"
#: libraries/navigation/Navigation.class.php:172
#, fuzzy
#| msgid "Events"
msgid "Events:"
msgstr "Események"
msgstr "Események:"
#: libraries/navigation/Navigation.class.php:173
#, fuzzy
#| msgid "Functions"
msgid "Functions:"
msgstr "Függvények"
msgstr "Függvények:"
#: libraries/navigation/Navigation.class.php:174
#, fuzzy
#| msgid "Procedures"
msgid "Procedures:"
msgstr "Eljárások"
msgstr "Eljárások:"
#: libraries/navigation/Navigation.class.php:175
#, fuzzy
#| msgid "Tables"
msgid "Tables:"
msgstr "Tábla"
msgstr "Tábla:"
#: libraries/navigation/Navigation.class.php:176
#, fuzzy
#| msgid "Views"
msgid "Views:"
msgstr "Nézetek"
msgstr "Nézetek:"
#: libraries/navigation/NavigationHeader.class.php:183
msgid "Home"
@ -8508,10 +8500,10 @@ msgid "RELATIONS FOR TABLE"
msgstr "TÁBLA KAPCSOLATAI"
#: libraries/plugins/export/ExportSql.class.php:1512
#, fuzzy, php-format
#, php-format
#| msgid "Structure for view"
msgid "Structure for view %s exported as a table"
msgstr "Nézet szerkezete"
msgstr "%s nézet struktúrája táblaként exportálva"
#: libraries/plugins/export/ExportSql.class.php:1600
msgid "Error reading data:"
@ -8867,16 +8859,14 @@ msgid "User preferences"
msgstr "Felhasználói beállítások"
#: libraries/relation.lib.php:264
#, fuzzy
#| msgid "Configuration: %s"
msgid "Configurable menus"
msgstr "Beállítás: %s"
msgstr "Beállítható menü"
#: libraries/relation.lib.php:275
#, fuzzy
#| msgid "Reload navigation frame"
msgid "Hide/show navigation items"
msgstr "A navigációs keret újratöltése"
msgstr "Navigációs elemek mutatása/elrejtése"
#: libraries/relation.lib.php:281
msgid "Quick steps to setup advanced features:"
@ -10045,7 +10035,7 @@ msgstr "Nincs"
#: libraries/server_privileges.lib.php:2552
#: libraries/server_privileges.lib.php:3267
msgid "User group"
msgstr ""
msgstr "Felhasználói csoport"
#: libraries/server_privileges.lib.php:618
msgid "Resource limits"
@ -10279,10 +10269,9 @@ msgid "Add privileges on the following table:"
msgstr "Jogok hozzáadása a következő táblán:"
#: libraries/server_privileges.lib.php:2690
#, fuzzy
#| msgid "Edit server"
msgid "Edit user group"
msgstr "Szerver módosítása"
msgstr "Felhasználói csoport szerkesztése"
#: libraries/server_privileges.lib.php:2727
msgid "Remove selected users"
@ -10345,84 +10334,73 @@ msgstr ""
#: libraries/server_privileges.lib.php:3212
#, php-format
msgid "Users of '%s' user group"
msgstr ""
msgstr "A '%s' felhasználói csoport felhasználói"
#: libraries/server_privileges.lib.php:3223
msgid "No users were found belonging to this user group."
msgstr ""
msgstr "Nem található ehhez a felhasználói csoporthoz tartozó felhasználó."
#: libraries/server_privileges.lib.php:3254
#: libraries/server_privileges.lib.php:3923
#, fuzzy
#| msgid "Users"
msgid "User groups"
msgstr "Felhasználók"
msgstr "Felhasználói csoportok"
#: libraries/server_privileges.lib.php:3268
#, fuzzy
#| msgid "Server version"
msgid "Server level tabs"
msgstr "Szerver verzió"
msgstr "Szerver level fülek"
#: libraries/server_privileges.lib.php:3269
#, fuzzy
#| msgid "Database server"
msgid "Database level tabs"
msgstr "Adatbázis-kiszolgáló"
msgstr "Adatbázis level fülek"
#: libraries/server_privileges.lib.php:3270
#, fuzzy
#| msgid "Table comments"
msgid "Table level tabs"
msgstr "Tábla megjegyzése"
msgstr "Tábla level fülek"
#: libraries/server_privileges.lib.php:3291
#, fuzzy
#| msgid "Views"
msgid "View users"
msgstr "Nézetek"
msgstr "Felhasználók mutatása"
#: libraries/server_privileges.lib.php:3328
#: libraries/server_privileges.lib.php:3389
#, fuzzy
#| msgid "Add user"
msgid "Add user group"
msgstr "Felhasználó hozzáadása"
msgstr "Felhasználói csoport hozzáadása"
#: libraries/server_privileges.lib.php:3392
#, php-format
msgid "Edit user group: '%s'"
msgstr ""
msgstr "'%s' Felhasználói csoport szerkesztése"
#: libraries/server_privileges.lib.php:3408
#, fuzzy
#| msgid "No privileges."
msgid "User group menu assignments"
msgstr "Nincsenek jogok."
msgstr "Felhasználói csoport menü hozzárendelések"
#: libraries/server_privileges.lib.php:3415
#, fuzzy
#| msgid "Column names: "
msgid "Group name:"
msgstr "Oszlopnevek: "
msgstr "Csoport neve:"
#: libraries/server_privileges.lib.php:3447
#, fuzzy
#| msgid "Server version"
msgid "Server-level tabs"
msgstr "Szerver verzió"
msgstr "Szerver level fülek"
#: libraries/server_privileges.lib.php:3450
#, fuzzy
#| msgid "Database server"
msgid "Database-level tabs"
msgstr "Adatbázis-kiszolgáló"
msgstr "Adatbázis level fülek"
#: libraries/server_privileges.lib.php:3453
#, fuzzy
#| msgid "Table comments"
msgid "Table-level tabs"
msgstr "Tábla megjegyzése"
msgstr "Tábla level fülek"
#: libraries/server_privileges.lib.php:3564
msgid "The selected user was not found in the privilege table."
@ -12624,7 +12602,7 @@ msgstr ""
"szükség, amelyek ezen a rendszeren nem elérhetőek."
#: setup/lib/index.lib.php:226
#, fuzzy, php-format
#, php-format
#| msgid ""
#| "%sLogin cookie validity%s greater than 1440 seconds may cause random "
#| "session invalidation if %ssession.gc_maxlifetime%s is lower than its "
@ -12633,9 +12611,9 @@ msgid ""
"%sLogin cookie validity%s greater than %ssession.gc_maxlifetime%s may cause "
"random session invalidation (currently session.gc_maxlifetime is %d)."
msgstr ""
"Az 1440 másodpercnél magasabb %sLogin cookie validity%s véletlenszerű "
"munkamenet érvénytelenítést okozhat, ha %ssession.gc_maxlifetime%s "
"alacsonyabb, mint az érték (jelenleg: %d)."
"A %sLogin cookie validity%s, amely nagyobb, mint a %ssession.gc_maxlifetime%"
"s, véletlenszerű munkamenet érvénytelenítést okozhat (a "
"session.gc_maxlifetime értéke jelenleg: %d)."
#: setup/lib/index.lib.php:228
#, php-format

View File

@ -4,8 +4,8 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-08-11 13:17+0200\n"
"PO-Revision-Date: 2013-08-11 13:46+0200\n"
"Last-Translator: Michal Čihař <michal@cihar.com>\n"
"PO-Revision-Date: 2013-08-14 05:01+0200\n"
"Last-Translator: 성현 양 <rctq@paran.com>\n"
"Language-Team: Korean <http://l10n.cihar.com/projects/phpmyadmin/master/ko/>\n"
"Language: ko\n"
"MIME-Version: 1.0\n"
@ -3385,7 +3385,6 @@ msgid "No preview available."
msgstr "미리보기가 불가능합니다."
#: libraries/Theme.class.php:404
#, fuzzy
msgid "take it"
msgstr "사용하기"
@ -3453,12 +3452,15 @@ msgid ""
"A fixed-point number (M, D) - the maximum number of digits (M) is 65 "
"(default 10), the maximum number of decimals (D) is 30 (default 0)"
msgstr ""
"고정소수점 숫자 (M, D) - 최대 자릿수(M)는 65이며 (기본값 10), 최대 소수점 자릿수(D)는 30입니다 (기본값 0)"
#: libraries/Types.class.php:309
msgid ""
"A small floating-point number, allowable values are -3.402823466E+38 to "
"-1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38"
msgstr ""
"작은 부동소수점 숫자, 허용 가능한 값은 -3.402823466E+38 에서 -1.175494351E-38 까지, 0, 그리고 "
"1.175494351E-38 에서 3.402823466E+38 까지입니다"
#: libraries/Types.class.php:311
msgid ""
@ -3466,6 +3468,9 @@ msgid ""
"-1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and "
"2.2250738585072014E-308 to 1.7976931348623157E+308"
msgstr ""
"배정밀도 부동소수점 숫자, 허용 가능한 값은 -1.7976931348623157E+308 에서 "
"-2.2250738585072014E-308 까지, 0, 그리고 2.2250738585072014E-308 에서 "
"1.7976931348623157E+308 까지입니다"
#: libraries/Types.class.php:313
msgid ""
@ -3618,11 +3623,11 @@ msgstr ""
msgid ""
"An enumeration, chosen from the list of up to 65,535 values or the special "
"'' error value"
msgstr ""
msgstr "열거형, 최대 65,535개의 지정된 값 또는 특수 오류 값 ('') 중에서 선택될 수 있음"
#: libraries/Types.class.php:357
msgid "A single value chosen from a set of up to 64 members"
msgstr ""
msgstr "최대 64개의 맴버 집합으로부터 선택되는 단일 값"
#: libraries/Types.class.php:359
msgid "A type that can store a geometry of any type"
@ -4136,7 +4141,7 @@ msgstr "사용불가"
#: libraries/config/FormDisplay.class.php:772
#, php-format
msgid "\"%s\" requires %s extension"
msgstr "%s 확장을 위해 \"%s\" 가 필요합니다."
msgstr "\"%s\"(은)는 확장기능 %s 이 필요합니다"
#: libraries/config/FormDisplay.class.php:791
#, fuzzy, php-format
@ -4152,7 +4157,7 @@ msgstr "(%s) 기능이 누락되어 내보낼 수 없습니다."
#: libraries/config/FormDisplay.class.php:807
msgid "SQL Validator is disabled"
msgstr "SQL 유효화검증기가 비활성화되어 있습니다"
msgstr "SQL 검증기능이 비활성화됨"
#: libraries/config/FormDisplay.class.php:814
msgid "SOAP extension not found"
@ -4256,7 +4261,6 @@ msgstr ""
"점[/strong]을 허용할 가능성을 가집니다."
#: libraries/config/messages.inc.php:20
#, fuzzy
msgid "Allow third party framing"
msgstr "서드파티 프레이밍 허용"
@ -4724,7 +4728,7 @@ msgstr "외래키 드롭다운 순서(정렬)"
#: libraries/config/messages.inc.php:153
msgid "A dropdown will be used if fewer items are present"
msgstr ""
msgstr "이보다 적은 항목의 경우 드롭다운이 사용됩니다"
#: libraries/config/messages.inc.php:154
msgid "Foreign key limit"
@ -4848,7 +4852,7 @@ msgstr "기타 핵심기능 설정"
#: libraries/config/messages.inc.php:192
msgid "Settings that didn't fit anywhere else"
msgstr ""
msgstr "어디에도 해당되지 않는 설정"
#: libraries/config/messages.inc.php:193
msgid "Page titles"
@ -5052,7 +5056,7 @@ msgstr "iconv 확장 파라미터"
msgid ""
"If enabled, phpMyAdmin continues computing multiple-statement queries even "
"if one of the queries failed"
msgstr ""
msgstr "활성화 할 경우, phpMyAdmin은 다중 쿼리 실행 중 하나가 실패하더라도 실행을 계속합니다"
#: libraries/config/messages.inc.php:241
msgid "Ignore multiple statement errors"

View File

@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-08-11 13:17+0200\n"
"PO-Revision-Date: 2013-08-05 10:50+0200\n"
"PO-Revision-Date: 2013-08-15 14:57+0200\n"
"Last-Translator: Dieter Adriaenssens <ruleant@users.sourceforge.net>\n"
"Language-Team: Dutch <http://l10n.cihar.com/projects/phpmyadmin/master/nl/>\n"
"Language: nl\n"
@ -945,10 +945,10 @@ msgid "This operation could take a long time. Proceed anyway?"
msgstr "Deze bewerking kan lang duren. Toch voortgaan?"
#: js/messages.php:44
#, fuzzy, php-format
#, php-format
#| msgid "Do you really want to execute \"%s\"?"
msgid "Do you really want to delete user group \"%s\"?"
msgstr "Weet u zeker dat u de query \"%s\" wil uitvoeren?"
msgstr "Weet u zeker dat u gebruikersgroep \"%s\" wil verwijderen?"
#: js/messages.php:47
msgid "Missing value in the form!"
@ -6172,7 +6172,6 @@ msgid "User groups table"
msgstr "Gebruikersgroepentabel"
#: libraries/config/messages.inc.php:460
#, fuzzy
#| msgid ""
#| "Leave blank for no user preferences storage in database, suggested: "
#| "[kbd]pma__userconfig[/kbd]"
@ -6180,8 +6179,8 @@ msgid ""
"Leave blank to disable the feature to hide and show navigation items, "
"suggested: [kbd]pma__navigationhiding[/kbd]"
msgstr ""
"Laat dit veld leeg om geen gebruikersvoorkeuren op te slaan in de databank, "
"suggestie: [kbd]pma__userconfig[/kbd]"
"Laat dit veld leeg om de optie, die navigatieonderdelen kan verbergen of te "
"tonen, uit te schakelen, suggestie: [kbd]pma__navigationhiding[/kbd]"
#: libraries/config/messages.inc.php:461
msgid "Hidden navigation items table"
@ -10389,19 +10388,16 @@ msgid "User groups"
msgstr "Gebruikersgroepen"
#: libraries/server_privileges.lib.php:3268
#, fuzzy
#| msgid "Server-level tabs"
msgid "Server level tabs"
msgstr "Tabs op serverniveau"
#: libraries/server_privileges.lib.php:3269
#, fuzzy
#| msgid "Database-level tabs"
msgid "Database level tabs"
msgstr "Tabs op databankniveau"
#: libraries/server_privileges.lib.php:3270
#, fuzzy
#| msgid "Table-level tabs"
msgid "Table level tabs"
msgstr "Tabs op tabelniveau"
@ -12660,7 +12656,7 @@ msgstr ""
"beschikbaar zijn op dit systeem."
#: setup/lib/index.lib.php:226
#, fuzzy, php-format
#, php-format
#| msgid ""
#| "%sLogin cookie validity%s greater than 1440 seconds may cause random "
#| "session invalidation if %ssession.gc_maxlifetime%s is lower than its "
@ -12669,9 +12665,9 @@ msgid ""
"%sLogin cookie validity%s greater than %ssession.gc_maxlifetime%s may cause "
"random session invalidation (currently session.gc_maxlifetime is %d)."
msgstr ""
"%sAanmeldingscookiegeldigheid%s groter dan 1440 seconden kan willekeurige "
"sessieproblemen veroorzaken als %ssession.gc_maxlifetime%s lager is dan deze "
"waarde (huidige waarde: %d)."
"%sAanmeldingscookiegeldigheid%s groter dan %ssession.gc_maxlifetime%s kan "
"willekeurige sessieproblemen veroorzaken (huidige waarde van "
"session.gc_maxlifetime is %d)."
#: setup/lib/index.lib.php:228
#, php-format

View File

@ -4,8 +4,8 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-08-11 13:17+0200\n"
"PO-Revision-Date: 2013-08-11 17:50+0200\n"
"Last-Translator: Mauricio Bastos <msbmail@gmail.com>\n"
"PO-Revision-Date: 2013-08-14 16:57+0200\n"
"Last-Translator: Stephan Souza <blad3d@gmail.com>\n"
"Language-Team: Portuguese (Brazil) "
"<http://l10n.cihar.com/projects/phpmyadmin/master/pt_BR/>\n"
"Language: pt_BR\n"
@ -691,10 +691,9 @@ msgid "Back"
msgstr "Voltar"
#: index.php:115 libraries/Footer.class.php:72
#, fuzzy
#| msgid "phpMyAdmin homepage"
msgid "phpMyAdmin Demo Server"
msgstr "Página inicial do phpMyAdmin"
msgstr "Servidor de Demonstração do phpMyAdmin"
#: index.php:119
#, php-format
@ -909,7 +908,7 @@ msgstr "O comando \"DROP DATABASE\" está desabilitado."
#: js/messages.php:35
msgid "Confirm"
msgstr ""
msgstr "Confirmar"
#: js/messages.php:36
#, php-format
@ -941,10 +940,10 @@ msgid "This operation could take a long time. Proceed anyway?"
msgstr "Esta operação pode ser demorada. Deseja prosseguir?"
#: js/messages.php:44
#, fuzzy, php-format
#, php-format
#| msgid "Do you really want to execute \"%s\"?"
msgid "Do you really want to delete user group \"%s\"?"
msgstr "Você realmente deseja executar \"%s\"?"
msgstr "Você realmente deseja remover o grupo \"%s\"?"
#: js/messages.php:47
msgid "Missing value in the form!"
@ -2842,13 +2841,12 @@ msgstr "Não pode ler (mover) arquivo carregado."
#: libraries/Footer.class.php:76
#, php-format
msgid "Currently running Git revision %1$s from the %2$s branch."
msgstr ""
msgstr "Atualmente rodando a revisão Git %1$s da branch %2$s."
#: libraries/Footer.class.php:83
#, fuzzy
#| msgid "Version information"
msgid "Git information missing!"
msgstr "Informações da versão"
msgstr "Faltando informações do Git!"
#: libraries/Footer.class.php:163 libraries/Footer.class.php:167
#: libraries/Footer.class.php:170
@ -4736,10 +4734,9 @@ msgstr "Desabilitar verificação de chaves estrangeiras"
#: libraries/config/messages.inc.php:126
#: libraries/plugins/export/ExportSql.class.php:154
#, fuzzy
#| msgid "Exporting rows from \"%s\" table"
msgid "Export views as tables"
msgstr "Exportando as linhas da tabela \"%s\""
msgstr "Exportando views como tabelas"
#: libraries/config/messages.inc.php:127 libraries/config/messages.inc.php:128
#: libraries/config/messages.inc.php:130 libraries/config/messages.inc.php:136
@ -6170,7 +6167,6 @@ msgstr ""
"banco de dados, sugestão: [kbd]pma__userconfig[/kbd]"
#: libraries/config/messages.inc.php:459
#, fuzzy
#| msgid "Use Host Table"
msgid "User groups table"
msgstr "Tabela de grupos de usuário"
@ -6986,7 +6982,6 @@ msgid "%s of %s"
msgstr "%s de %s"
#: libraries/display_import.lib.php:454
#, fuzzy
#| msgid "Uploading your import file…"
msgid "Uploading your import file…"
msgstr "Subindo seu arquivo de importação…"
@ -7761,34 +7756,29 @@ msgid "An error has occured while loading the navigation tree"
msgstr "Um erro ocorreu enquanto carregava a árvore de navegação"
#: libraries/navigation/Navigation.class.php:172
#, fuzzy
#| msgid "Events"
msgid "Events:"
msgstr "Eventos"
msgstr "Eventos:"
#: libraries/navigation/Navigation.class.php:173
#, fuzzy
#| msgid "Functions"
msgid "Functions:"
msgstr "Funções"
msgstr "Funções:"
#: libraries/navigation/Navigation.class.php:174
#, fuzzy
#| msgid "Procedures"
msgid "Procedures:"
msgstr "Procedimentos"
msgstr "Procedimentos:"
#: libraries/navigation/Navigation.class.php:175
#, fuzzy
#| msgid "Tables"
msgid "Tables:"
msgstr "Tabelas"
msgstr "Tabelas:"
#: libraries/navigation/Navigation.class.php:176
#, fuzzy
#| msgid "Views"
msgid "Views:"
msgstr "Views"
msgstr "Views:"
#: libraries/navigation/NavigationHeader.class.php:183
msgid "Home"
@ -8540,10 +8530,10 @@ msgid "RELATIONS FOR TABLE"
msgstr "RELACIONAMENTOS PARA TABELAS"
#: libraries/plugins/export/ExportSql.class.php:1512
#, fuzzy, php-format
#, php-format
#| msgid "Structure for view"
msgid "Structure for view %s exported as a table"
msgstr "Estrutura para view"
msgstr "Estrutura da view %s exportado como tabela"
#: libraries/plugins/export/ExportSql.class.php:1600
msgid "Error reading data:"
@ -8895,16 +8885,14 @@ msgid "User preferences"
msgstr "Preferências do usuário"
#: libraries/relation.lib.php:264
#, fuzzy
#| msgid "Configuration: %s"
msgid "Configurable menus"
msgstr "Configuração: %s"
msgstr "Menus Configuráveis"
#: libraries/relation.lib.php:275
#, fuzzy
#| msgid "Reload navigation frame"
msgid "Hide/show navigation items"
msgstr "Recarregar frame de navegação"
msgstr "Exibir/ocultar itens de navegação"
#: libraries/relation.lib.php:281
msgid "Quick steps to setup advanced features:"
@ -10068,7 +10056,7 @@ msgstr "Nenhum privilégio"
#: libraries/server_privileges.lib.php:2552
#: libraries/server_privileges.lib.php:3267
msgid "User group"
msgstr ""
msgstr "Grupo de usuários"
#: libraries/server_privileges.lib.php:618
msgid "Resource limits"
@ -10301,10 +10289,9 @@ msgid "Add privileges on the following table:"
msgstr "Adicionar privilégios na seguinte tabela:"
#: libraries/server_privileges.lib.php:2690
#, fuzzy
#| msgid "Edit server"
msgid "Edit user group"
msgstr "Editar servidor"
msgstr "Editar grupo de usuários"
#: libraries/server_privileges.lib.php:2727
msgid "Remove selected users"
@ -10367,7 +10354,7 @@ msgstr ""
#: libraries/server_privileges.lib.php:3212
#, php-format
msgid "Users of '%s' user group"
msgstr ""
msgstr "Usuários do grupo '%s'"
#: libraries/server_privileges.lib.php:3223
msgid "No users were found belonging to this user group."

View File

@ -64,30 +64,8 @@ if (isset($_REQUEST['do_save_data'])) {
*
* submit_mult_*_x comes from IE if <input type="img" ...> is used
*/
if (isset($_REQUEST['submit_mult_change_x'])) {
$submit_mult = 'change';
} elseif (isset($_REQUEST['submit_mult_drop_x'])) {
$submit_mult = 'drop';
} elseif (isset($_REQUEST['submit_mult_primary_x'])) {
$submit_mult = 'primary';
} elseif (isset($_REQUEST['submit_mult_index_x'])) {
$submit_mult = 'index';
} elseif (isset($_REQUEST['submit_mult_unique_x'])) {
$submit_mult = 'unique';
} elseif (isset($_REQUEST['submit_mult_spatial_x'])) {
$submit_mult = 'spatial';
} elseif (isset($_REQUEST['submit_mult_fulltext_x'])) {
$submit_mult = 'ftext';
} elseif (isset($_REQUEST['submit_mult_browse_x'])) {
$submit_mult = 'browse';
} elseif (isset($_REQUEST['submit_mult'])) {
$submit_mult = $_REQUEST['submit_mult'];
} elseif (isset($_REQUEST['mult_btn']) && $_REQUEST['mult_btn'] == __('Yes')) {
$submit_mult = 'row_delete';
if (isset($_REQUEST['selected'])) {
$_REQUEST['selected_fld'] = $_REQUEST['selected'];
}
}
$submit_mult = PMA_getMultipleFieldCommandType();
if (! empty($submit_mult)) {
if (isset($_REQUEST['selected_fld'])) {
$err_url = 'tbl_structure.php?' . PMA_URL_getCommon($db, $table);

View File

@ -37,7 +37,10 @@ class PMA_DBI_Mysql_Test extends PHPUnit_Framework_TestCase
* @return void
*/
protected function setUp()
{
{
$GLOBALS['cfg']['Server']['ssl'] = true;
$GLOBALS['cfg']['PersistentConnections'] = false;
$GLOBALS['cfg']['Server']['compress'] = true;
$this->object = new PMA_DBI_Mysql();
}
@ -66,7 +69,124 @@ class PMA_DBI_Mysql_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
false,
$this->object->realMultiQuery(null, "select * from PMA")
);
);
}
/**
* Test for mysql related functions, using runkit_function_redefine
*
* @return void
*
* @group medium
*/
public function testMysqlDBI()
{
if (! PMA_HAS_RUNKIT) {
$this->markTestSkipped("Cannot redefine function");
}
//FOR UT, we just test the right mysql client API is called
runkit_function_redefine('mysql_pconnect','','return "mysql_pconnect";');
runkit_function_redefine('mysql_connect','','return "mysql_connect";');
runkit_function_redefine('mysql_query','','return "mysql_query";');
runkit_function_redefine('mysql_fetch_array','','return "mysql_fetch_array";');
runkit_function_redefine('mysql_data_seek','','return "mysql_data_seek";');
runkit_function_redefine('mysql_get_host_info','','return "mysql_get_host_info";');
runkit_function_redefine('mysql_get_proto_info','','return "mysql_get_proto_info";');
runkit_function_redefine('mysql_field_flags','','return "mysql_field_flags";');
runkit_function_redefine('mysql_field_name','','return "mysql_field_name";');
runkit_function_redefine('mysql_field_len','','return "mysql_field_len";');
$user = 'PMA_user';
$password = 'PMA_password';
$is_controluser = false;
$server = array(
'port' => 8080,
'socket' => 123,
'host' => 'locahost',
);
$auxiliary_connection = true;
//test for connect
$ret = $this->object->connect(
$user, $password, $is_controluser,
$server, $auxiliary_connection
);
$this->assertEquals(
'mysql_connect',
$ret
);
$GLOBALS['cfg']['PersistentConnections'] = true;
$ret = $this->object->connect(
$user, $password, $is_controluser,
$server, $auxiliary_connection
);
$this->assertEquals(
'mysql_pconnect',
$ret
);
//test for realQuery
$query = 'select * from DBI';
$link = $ret;
$options = 0;
$ret = $this->object->realQuery($query, $link, $options);
$this->assertEquals(
'mysql_query',
$ret
);
//test for fetchArray
$result = $ret;
$ret = $this->object->fetchArray($result);
$this->assertEquals(
'mysql_fetch_array',
$ret
);
//test for dataSeek
$result = $ret;
$offset = 12;
$ret = $this->object->dataSeek($result, $offset);
$this->assertEquals(
'mysql_data_seek',
$ret
);
//test for getHostInfo
$ret = $this->object->getHostInfo($ret);
$this->assertEquals(
'mysql_get_host_info',
$ret
);
//test for getProtoInfo
$ret = $this->object->getProtoInfo($ret);
$this->assertEquals(
'mysql_get_proto_info',
$ret
);
//test for fieldLen
$ret = $this->object->fieldLen($ret, $offset);
$this->assertEquals(
'mysql_field_len',
$ret
);
//test for fieldName
$ret = $this->object->fieldName($ret, $offset);
$this->assertEquals(
'mysql_field_name',
$ret
);
//test for fieldFlags
$ret = $this->object->fieldFlags($ret, $offset);
$this->assertEquals(
'mysql_field_flags',
$ret
);
}
/**
@ -83,7 +203,7 @@ class PMA_DBI_Mysql_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
false,
$this->object->selectDb("PMA")
);
);
}
/**
@ -99,12 +219,12 @@ class PMA_DBI_Mysql_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
false,
$this->object->moreResults()
);
);
//PHP's 'mysql' extension does not support multi_queries
$this->assertEquals(
false,
$this->object->nextResult()
);
);
}
/**

View File

@ -34,7 +34,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -44,12 +44,12 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCodegen::initSpecificVariables
*
*
* @return void
*/
public function testInitSpecificVariables()
{
$method = new ReflectionMethod('ExportCodegen', 'initSpecificVariables');
$method->setAccessible(true);
$method->invoke($this->object, null);
@ -79,7 +79,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCodegen::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -184,7 +184,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCodegen::exportHeader
*
*
* @return void
*/
public function testExportHeader()
@ -196,7 +196,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCodegen::exportFooter
*
*
* @return void
*/
public function testExportFooter()
@ -208,7 +208,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCodegen::exportDBHeader
*
*
* @return void
*/
public function testExportDBHeader()
@ -220,7 +220,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCodegen::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooter()
@ -232,22 +232,23 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCodegen::exportData
*
*
* @return void
*/
public function testExportData()
{
$GLOBALS['codegen_format'] = 1;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['output_charset_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
$GLOBALS['asfile'] = false;
$GLOBALS['asfile'] = true;
$GLOBALS['save_on_server'] = false;
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
ob_start();
$this->object->exportData(
'testDB', 'testTable', "\n", 'example.com', 'test'
@ -255,22 +256,22 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
$result = ob_get_clean();
$this->assertContains(
'&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;',
'<?xml version="1.0" encoding="utf-8" ?>',
$result
);
$this->assertContains(
'&lt;class name=&quot;TestTable&quot; table=&quot;TestTable&quot;&gt;',
'<class name="TestTable" table="TestTable">',
$result
);
$this->assertContains(
'&lt;/class&gt;',
'</class>',
$result
);
$this->assertContains(
'&lt;/hibernate-mapping&gt;',
'</hibernate-mapping>',
$result
);
@ -287,7 +288,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCodegen::cgMakeIdentifier
*
*
* @return void
*/
public function testCgMakeIdentifier()
@ -310,7 +311,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCodegen::_handleNHibernateCSBody
*
*
* @return void
*/
public function testHandleNHibernateCSBody()
@ -375,7 +376,7 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCodegen::_handleNHibernateXMLBody
*
*
* @return void
*/
public function testHandleNHibernateXMLBody()
@ -432,13 +433,13 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
* Test for
* - ExportCodegen::_getCgFormats
* - ExportCodegen::_setCgFormats
*
*
* @return void
*/
public function testSetGetCgFormats()
{
$reflection = new ReflectionClass('ExportCodegen');
$getter = $reflection->getMethod('_getCgFormats');
$setter = $reflection->getMethod('_setCgFormats');
@ -457,13 +458,13 @@ class PMA_ExportCodegen_Test extends PHPUnit_Framework_TestCase
* Test for
* - ExportCodegen::_getCgHandlers
* - ExportCodegen::_setCgHandlers
*
*
* @return void
*/
public function testSetGetCgHandlers()
{
$reflection = new ReflectionClass('ExportCodegen');
$getter = $reflection->getMethod('_getCgHandlers');
$setter = $reflection->getMethod('_setCgHandlers');

View File

@ -34,7 +34,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -44,7 +44,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCsv::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -132,7 +132,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'enclosed',
$property->getName()
@ -149,7 +149,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'escaped',
$property->getName()
@ -166,7 +166,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'terminated',
$property->getName()
@ -183,7 +183,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'null',
$property->getName()
@ -200,7 +200,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'removeCRLF',
$property->getName()
@ -217,7 +217,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'columns',
$property->getName()
@ -234,7 +234,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
'HiddenPropertyItem',
$property
);
$this->assertEquals(
'structure_or_data',
$property->getName()
@ -244,7 +244,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCsv::exportHeader
*
*
* @return void
*/
public function testExportHeader()
@ -400,7 +400,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
);
// case 7
$GLOBALS['csv_terminated'] = 'a\\rb\\nc\\t';
$GLOBALS['csv_separator'] = 'a\\t';
@ -421,7 +421,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCsv::exportFooter
*
*
* @return void
*/
public function testExportFooter()
@ -433,7 +433,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCsv::exportDBHeader
*
*
* @return void
*/
public function testExportDBHeader()
@ -445,7 +445,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCsv::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooter()
@ -457,7 +457,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCsv::exportDBCreate
*
*
* @return void
*/
public function testExportDBCreate()
@ -469,7 +469,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportCsv::exportData
*
*
* @return void
*/
public function testExportData()
@ -533,8 +533,9 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
$GLOBALS['what'] = 'UT';
$GLOBALS['UT_null'] = 'customNull';
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['output_charset_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
$GLOBALS['asfile'] = false;
$GLOBALS['asfile'] = true;
$GLOBALS['save_on_server'] = false;
ob_start();
@ -593,7 +594,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
$result = ob_get_clean();
$this->assertEquals(
"&quot;foo&quot;bar;customNull;",
"\"foo\"bar;customNull;",
$result
);
@ -633,7 +634,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
$GLOBALS['what'] = 'excel';
$GLOBALS['excel_removeCRLF'] = true;
$GLOBALS['csv_escaped'] = '"';
ob_start();
$this->assertTrue(
$this->object->exportData(
@ -643,7 +644,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
$result = ob_get_clean();
$this->assertEquals(
"&quot;foo&quot;&quot;bar;&quot;test&quot;;",
"\"foo\"\"bar;\"test\";",
$result
);
@ -682,7 +683,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
$GLOBALS['csv_enclosed'] = '"';
unset($GLOBALS['excel_removeCRLF']);
$GLOBALS['csv_escaped'] = ';';
ob_start();
$this->assertTrue(
$this->object->exportData(
@ -692,7 +693,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
$result = ob_get_clean();
$this->assertEquals(
"&quot;foo;&quot;bar;&quot;test\n&quot;;",
"\"foo;\"bar;\"test\n\";",
$result
);
@ -730,7 +731,7 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
$GLOBALS['csv_enclosed'] = '"';
$GLOBALS['csv_escaped'] = ';';
$GLOBALS['csv_escaped'] = '#';
ob_start();
$this->assertTrue(
$this->object->exportData(
@ -738,11 +739,11 @@ class PMA_ExportCsv_Test extends PHPUnit_Framework_TestCase
)
);
$result = ob_get_clean();
$this->assertEquals(
"&quot;foo#&quot;bar&quot;&quot;foo#&quot;bar;&quot;test\n" .
"&quot;&quot;test\n" .
"&quot;;",
"\"foo#\"bar\"\"foo#\"bar;\"test\n" .
"\"\"test\n" .
"\";",
$result
);
}

View File

@ -6,6 +6,7 @@
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportHtmlword.class.php';
require_once 'libraries/DatabaseInterface.class.php';
require_once 'libraries/Util.class.php';
require_once 'libraries/Theme.class.php';
require_once 'libraries/Config.class.php';
@ -31,14 +32,15 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$GLOBALS['server'] = 0;
$this->object = new ExportHtmlword();
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['output_charset_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
$GLOBALS['asfile'] = false;
$GLOBALS['asfile'] = true;
$GLOBALS['save_on_server'] = false;
}
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -48,7 +50,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportHtmlword::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -183,7 +185,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
'Replace NULL with:',
$property->getText()
);
$property = array_shift($generalProperties);
$this->assertInstanceOf(
@ -204,7 +206,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportHtmlword::exportHeader
*
*
* @return void
*/
public function testExportHeader()
@ -213,7 +215,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$this->object->exportHeader();
$result = ob_get_clean();
$expected = htmlspecialchars(
$expected =
'<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
@ -225,9 +227,8 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
<meta http-equiv="Content-type" content="text/html;charset='
. 'utf-8' . '" />
</head>
<body>'
);
<body>';
$this->assertEquals(
$expected,
$result
@ -240,7 +241,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$this->object->exportHeader();
$result = ob_get_clean();
$expected = htmlspecialchars(
$expected =
'<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
@ -252,8 +253,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
<meta http-equiv="Content-type" content="text/html;charset='
. 'ISO-8859-1' . '" />
</head>
<body>'
);
<body>';
$this->assertEquals(
$expected,
@ -263,7 +263,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportHtmlword::exportFooter
*
*
* @return void
*/
public function testExportFooter()
@ -275,14 +275,14 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$result = ob_get_clean();
$this->assertEquals(
htmlspecialchars('</body></html>'),
'</body></html>',
$result
);
}
/**
* Test for ExportHtmlword::exportDBHeader
*
*
* @return void
*/
public function testExportDBHeader()
@ -294,14 +294,14 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$result = ob_get_clean();
$this->assertEquals(
'&lt;h1&gt;Database d&amp;quot;b&lt;/h1&gt;',
'<h1>Database d&quot;b</h1>',
$result
);
}
/**
* Test for ExportHtmlword::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooter()
@ -313,7 +313,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportHtmlword::exportDBCreate
*
*
* @return void
*/
public function testExportDBCreate()
@ -325,13 +325,13 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportHtmlword::exportData
*
*
* @return void
*/
public function testExportData()
{
// case 1
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
@ -365,8 +365,9 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$GLOBALS['what'] = 'UT';
$GLOBALS['UT_null'] = 'customNull';
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['output_charset_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
$GLOBALS['asfile'] = false;
$GLOBALS['asfile'] = true;
$GLOBALS['save_on_server'] = false;
ob_start();
@ -379,8 +380,8 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
'<h2>Dumping data for table testTable</h2>' .
'<table class="width100" cellspacing="1"><tr class="print-category">' .
'<td class="print"><strong>foobar</strong></td>' .
'<table class="width100" cellspacing="1"><tr class="print-category">' .
'<td class="print"><strong>foobar</strong></td>' .
'<td class="print"><strong>foobar</strong></td>' .
'<td class="print"><strong>foobar</strong></td>' .
'<td class="print"><strong>foobar</strong></td>' .
@ -394,7 +395,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportHtmlword::getTableDefStandIn
*
*
* @return void
*/
public function testGetTableDefStandIn()
@ -404,7 +405,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
->getMock();
// case 1
$keys = array(
array(
'Non_unique' => 0,
@ -450,7 +451,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportHtmlword::getTableDef
*
*
* @return void
*/
public function testGetTableDef()
@ -506,7 +507,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
->method('getColumns')
->with('database', '')
->will($this->returnValue(array($columns)));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue(true));
@ -565,7 +566,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
);
// case 2
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
@ -610,7 +611,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
->method('getColumns')
->with('database', '')
->will($this->returnValue(array($columns)));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue(true));
@ -662,7 +663,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
);
// case 3
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
@ -680,7 +681,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
->method('getColumns')
->with('database', '')
->will($this->returnValue(array($columns)));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue(true));
@ -733,7 +734,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportHtmlword::getTriggers
*
*
* @return void
*/
public function testGetTriggers()
@ -750,7 +751,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
'definition' => 'def'
)
);
$dbi->expects($this->once())
->method('getTriggers')
->with('database', 'table')
@ -763,7 +764,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$result = $method->invoke($this->object, 'database', 'table');
$this->assertContains(
'<td class="print">tna&quot;me</td>' .
'<td class="print">tna&quot;me</td>' .
'<td class="print">ac&gt;t</td>' .
'<td class="print">manip&amp;</td>' .
'<td class="print">def</td>',
@ -773,12 +774,12 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportHtmlword::exportStructure
*
*
* @return void
*/
public function testExportStructure()
{
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
@ -816,7 +817,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
->will($this->returnValue('dumpText4'));
$GLOBALS['dbi'] = $dbi;
ob_start();
$this->assertTrue(
$this->object->exportStructure(
@ -826,7 +827,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$result = ob_get_clean();
$this->assertEquals(
'&lt;h2&gt;Table structure for table tbl&lt;/h2&gt;dumpText1',
'<h2>Table structure for table tbl</h2>dumpText1',
$result
);
@ -839,7 +840,7 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$result = ob_get_clean();
$this->assertEquals(
'&lt;h2&gt;Triggers tbl&lt;/h2&gt;dumpText2',
'<h2>Triggers tbl</h2>dumpText2',
$result
);
@ -850,9 +851,9 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
)
);
$result = ob_get_clean();
$this->assertEquals(
'&lt;h2&gt;Structure for view tbl&lt;/h2&gt;dumpText3',
'<h2>Structure for view tbl</h2>dumpText3',
$result
);
@ -865,14 +866,14 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$result = ob_get_clean();
$this->assertEquals(
'&lt;h2&gt;Stand-in structure for view tbl&lt;/h2&gt;dumpText4',
'<h2>Stand-in structure for view tbl</h2>dumpText4',
$result
);
}
/**
* Test for ExportHtmlword::formatOneColumnDefinition
*
*
* @return void
*/
public function testFormatOneColumnDefinition()

View File

@ -30,15 +30,16 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
{
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['output_charset_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
$GLOBALS['asfile'] = false;
$GLOBALS['asfile'] = true;
$GLOBALS['save_on_server'] = false;
$this->object = new ExportJson();
}
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -48,7 +49,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportJson::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -119,7 +120,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
'HiddenPropertyItem',
$property
);
$this->assertEquals(
'structure_or_data',
$property->getName()
@ -129,7 +130,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportJson::exportHeader
*
*
* @return void
*/
public function testExportHeader()
@ -150,7 +151,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportJson::exportFooter
*
*
* @return void
*/
public function testExportFooter()
@ -162,7 +163,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportJson::exportDBHeader
*
*
* @return void
*/
public function testExportDBHeader()
@ -180,7 +181,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportJson::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooter()
@ -192,7 +193,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportJson::exportDBCreate
*
*
* @return void
*/
public function testExportDBCreate()
@ -204,7 +205,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportJson::exportData
*
*
* @return void
*/
public function testExportData()
@ -212,7 +213,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->once())
->method('numFields')
->with(null)
@ -242,7 +243,7 @@ class PMA_ExportJson_Test extends PHPUnit_Framework_TestCase
$this->expectOutputString(
"// db.tbl\n\n" .
"[{&quot;f1&quot;:&quot;foo&quot;}, {&quot;f1&quot;:&quot;bar&quot;}]"
"[{\"f1\":\"foo\"}, {\"f1\":\"bar\"}]"
);
$this->assertTrue(

View File

@ -30,8 +30,9 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
{
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['output_charset_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
$GLOBALS['asfile'] = false;
$GLOBALS['asfile'] = true;
$GLOBALS['save_on_server'] = false;
$GLOBALS['plugin_param'] = array();
$GLOBALS['plugin_param']['export_type'] = 'table';
@ -42,7 +43,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -52,7 +53,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportLatex::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -128,7 +129,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'caption',
$property->getName()
@ -164,7 +165,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
'RadioPropertyItem',
$property
);
$this->assertEquals(
'structure_or_data',
$property->getName()
@ -210,7 +211,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'structure_caption',
$property->getName()
@ -232,7 +233,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'structure_continued_caption',
$property->getName()
@ -254,7 +255,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'structure_label',
$property->getName()
@ -276,7 +277,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'relation',
$property->getName()
@ -293,7 +294,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'comments',
$property->getName()
@ -310,7 +311,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'mime',
$property->getName()
@ -352,7 +353,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'columns',
$property->getName()
@ -369,7 +370,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'data_caption',
$property->getName()
@ -391,7 +392,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'data_continued_caption',
$property->getName()
@ -413,7 +414,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'data_label',
$property->getName()
@ -435,7 +436,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'null',
$property->getName()
@ -463,7 +464,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportLatex::exportHeader
*
*
* @return void
*/
public function testExportHeader()
@ -471,7 +472,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
$GLOBALS['crlf'] = "\n";
$GLOBALS['cfg']['Server']['port'] = 80;
$GLOBALS['cfg']['Server']['host'] = 'localhost';
ob_start();
$this->assertTrue(
$this->object->exportHeader()
@ -481,12 +482,12 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
$this->assertContains(
"\n% Host: localhost:80",
$result
);
);
}
/**
* Test for ExportLatex::exportFooter
*
*
* @return void
*/
public function testExportFooter()
@ -498,7 +499,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportLatex::exportDBHeader
*
*
* @return void
*/
public function testExportDBHeader()
@ -516,7 +517,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportLatex::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooter()
@ -528,7 +529,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportLatex::exportDBCreate
*
*
* @return void
*/
public function testExportDBCreate()
@ -540,7 +541,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportLatex::exportData
*
*
* @return void
*/
public function testExportData()
@ -556,7 +557,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->once())
->method('numFields')
->with(null)
@ -613,7 +614,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->once())
->method('numFields')
->with(null)
@ -655,7 +656,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportLatex::exportStructure
*
*
* @return void
*/
public function testExportStructure()
@ -723,7 +724,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
->method('getColumns')
->with('database', '')
->will($this->returnValue($columns));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue(true));
@ -777,30 +778,30 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
//echo $result; die;
$this->assertEquals(
"\n" . '%' . "\n" .
'% Structure: ' . "\n" .
'% Structure: ' . "\n" .
'%' . "\n" .
' \\begin{longtable}{|l|c|c|c|l|l|} ' . "\n" .
' \\hline \\multicolumn{1}{|c|}{\\textbf{Column}} &amp; ' .
'\\multicolumn{1}{|c|}{\\textbf{Type}} &amp; \\multicolumn{1}{|c|}' .
'{\\textbf{Null}} &amp; \\multicolumn{1}{|c|}{\\textbf{Default}} &amp;' .
' \\multicolumn{1}{|c|}{\\textbf{Comments}} &amp; \\multicolumn{1}' .
' \\hline \\multicolumn{1}{|c|}{\\textbf{Column}} & ' .
'\\multicolumn{1}{|c|}{\\textbf{Type}} & \\multicolumn{1}{|c|}' .
'{\\textbf{Null}} & \\multicolumn{1}{|c|}{\\textbf{Default}} &' .
' \\multicolumn{1}{|c|}{\\textbf{Comments}} & \\multicolumn{1}' .
'{|c|}{\\textbf{MIME}} \\\\ \\hline \\hline' . "\n" .
'\\endfirsthead' . "\n" . ' \\hline \\multicolumn{1}{|c|}' .
'{\\textbf{Column}} &amp; \\multicolumn{1}' . '{|c|}{\\textbf{Type}}' .
' &amp; \\multicolumn{1}{|c|}{\\textbf{Null}} &amp; \\multicolumn' .
'{1}{|c|}{\\textbf{Default}} &amp; \\multicolumn{1}{|c|}{\\textbf' .
'{Comments}} &amp; \\multicolumn{1}{|c|}{\\textbf{MIME}} \\\\ ' .
'{\\textbf{Column}} & \\multicolumn{1}' . '{|c|}{\\textbf{Type}}' .
' & \\multicolumn{1}{|c|}{\\textbf{Null}} & \\multicolumn' .
'{1}{|c|}{\\textbf{Default}} & \\multicolumn{1}{|c|}{\\textbf' .
'{Comments}} & \\multicolumn{1}{|c|}{\\textbf{MIME}} \\\\ ' .
'\\hline \\hline \\endhead \\endfoot ' . "\n" . '\\textbf{\\textit' .
'{name1}} &amp; set(abc) &amp; Yes &amp; NULL &amp; ' .
'&amp; Testmimetype/ \\\\ \\hline ' . "\n" .
'fields &amp; &amp; No &amp; def &amp; &amp; \\\\ \\hline ' . "\n" .
'{name1}} & set(abc) & Yes & NULL & ' .
'& Testmimetype/ \\\\ \\hline ' . "\n" .
'fields & & No & def & & \\\\ \\hline ' . "\n" .
' \\end{longtable}' . "\n",
$result
);
// case 2
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
@ -841,7 +842,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
->method('getColumns')
->with('database', '')
->will($this->returnValue($columns));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue(true));
@ -889,8 +890,8 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
$result = ob_get_clean();
$this->assertContains(
'\\textbf{\\textit{name1}} &amp; set(abc) &amp; Yes &amp; NULL &amp; ' .
'ftable (ffield) &amp; &amp; \\\\ \\hline',
'\\textbf{\\textit{name1}} & set(abc) & Yes & NULL & ' .
'ftable (ffield) & & \\\\ \\hline',
$result
);
@ -909,7 +910,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
->method('getColumns')
->with('database', '')
->will($this->returnValue($columns));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue(true));
@ -959,7 +960,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
)
);
$result = ob_get_clean();
$this->assertContains(
'\\caption{latexstructure} \\label{latexlabel}',
$result
@ -985,7 +986,7 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportLatex::texEscape
*
*
* @return void
*/
public function testTexEscape()

View File

@ -30,15 +30,16 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
{
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['output_charset_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
$GLOBALS['asfile'] = false;
$GLOBALS['asfile'] = true;
$GLOBALS['save_on_server'] = false;
$this->object = new ExportMediawiki();
}
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -48,7 +49,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportMediawiki::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -124,7 +125,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
'OptionsPropertySubgroup',
$property
);
$this->assertEquals(
'dump_table',
$property->getName()
@ -141,7 +142,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
'RadioPropertyItem',
$sgHeader
);
$this->assertEquals(
'structure_or_data',
$sgHeader->getName()
@ -162,7 +163,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'caption',
$property->getName()
@ -179,7 +180,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'headers',
$property->getName()
@ -193,7 +194,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportMediawiki::exportHeader
*
*
* @return void
*/
public function testExportHeader()
@ -205,7 +206,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportMediawiki::exportFooter
*
*
* @return void
*/
public function testExportFooter()
@ -217,7 +218,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportMediawiki::exportDBHeader
*
*
* @return void
*/
public function testExportDBHeader()
@ -229,7 +230,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportMediawiki::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooter()
@ -241,7 +242,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportMediawiki::exportDBCreate
*
*
* @return void
*/
public function testExportDBCreate()
@ -253,7 +254,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportMediaWiki::exportStructure
*
*
* @return void
*/
public function testExportStructure()
@ -299,14 +300,14 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
$result = ob_get_clean();
$this->assertEquals(
"\n&lt;!--\n" .
"\n<!--\n" .
"Table structure for `table`\n" .
"--&gt;\n" .
"-->\n" .
"\n" .
"{| class=&quot;wikitable&quot; style=&quot;text-align:center;&quot;\n" .
"{| class=\"wikitable\" style=\"text-align:center;\"\n" .
"|+'''table'''\n" .
"|- style=&quot;background:#ffdead;&quot;\n" .
"! style=&quot;background:#ffffff&quot; | \n" .
"|- style=\"background:#ffdead;\"\n" .
"! style=\"background:#ffffff\" | \n" .
" | name1\n" .
" | fields\n" .
"|-\n" .
@ -331,7 +332,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
/**
* This case produces an error, should it be tested?
ob_start();
$this->assertTrue(
$this->object->exportStructure(
@ -343,7 +344,7 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for ExportMediawiki::exportData
*
*
* @return void
*/
public function testExportData()
@ -414,12 +415,12 @@ class PMA_ExportMediawiki_Test extends PHPUnit_Framework_TestCase
$result = ob_get_clean();
$this->assertEquals(
"\n&lt;!--\n" .
"\n<!--\n" .
"Table data for `table`\n" .
"--&gt;\n" .
"-->\n" .
"\n" .
"{| class=&quot;wikitable sortable&quot; style=&quot;text-align:" .
"center;&quot;\n" .
"{| class=\"wikitable sortable\" style=\"text-align:" .
"center;\"\n" .
"|+'''table'''\n" .
"|-\n" .
" ! name1\n" .

View File

@ -6,6 +6,7 @@
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportOds.class.php';
require_once 'libraries/DatabaseInterface.class.php';
require_once 'libraries/Util.class.php';
require_once 'libraries/Theme.class.php';
require_once 'libraries/Config.class.php';
@ -30,15 +31,16 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
{
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['output_charset_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
$GLOBALS['asfile'] = false;
$GLOBALS['asfile'] = true;
$GLOBALS['save_on_server'] = false;
$this->object = new ExportOds();
}
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -48,7 +50,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOds::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -123,7 +125,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'null',
$property->getName()
@ -140,7 +142,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'columns',
$property->getName()
@ -157,7 +159,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
'HiddenPropertyItem',
$property
);
$this->assertEquals(
'structure_or_data',
$property->getName()
@ -167,7 +169,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOds::exportHeader
*
*
* @return void
*/
public function testExportHeader()
@ -183,13 +185,15 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOds::exportFooter
*
*
* @return void
*/
public function testExportFooter()
{
$GLOBALS['ods_buffer'] = 'header';
$this->expectOutputRegex('/^PK.*content.xml/');
$this->assertTrue(
$this->object->exportFooter()
);
@ -217,7 +221,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOds::exportDBHeader
*
*
* @return void
*/
public function testExportDBHeader()
@ -229,7 +233,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOds::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooter()
@ -241,7 +245,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOds::exportDBCreate
*
*
* @return void
*/
public function testExportDBCreate()
@ -253,7 +257,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOds::exportData
*
*
* @return void
*/
public function testExportData()
@ -378,7 +382,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOds::exportData
*
*
* @return void
*/
public function testExportDataWithFieldNames()
@ -397,7 +401,7 @@ class PMA_ExportOds_Test extends PHPUnit_Framework_TestCase
$dbi->expects($this->any())
->method('fieldFlags')
->will($this->returnValue('BINARYTEST'));
$dbi->expects($this->once())
->method('query')
->with('SELECT', null, PMA_DatabaseInterface::QUERY_UNBUFFERED)

View File

@ -30,8 +30,9 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
{
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['output_charset_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
$GLOBALS['asfile'] = false;
$GLOBALS['asfile'] = true;
$GLOBALS['save_on_server'] = false;
$GLOBALS['plugin_param'] = array();
$GLOBALS['plugin_param']['export_type'] = 'table';
@ -42,7 +43,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -52,7 +53,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOdt::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -137,7 +138,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
'RadioPropertyItem',
$property
);
$this->assertEquals(
'structure_or_data',
$property->getName()
@ -182,7 +183,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'relation',
$property->getName()
@ -199,7 +200,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'comments',
$property->getName()
@ -216,7 +217,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'mime',
$property->getName()
@ -258,7 +259,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
$this->assertEquals(
'columns',
$property->getName()
@ -275,7 +276,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'null',
$property->getName()
@ -303,13 +304,13 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOdt::exportHeader
*
*
* @return void
*/
public function testExportHeader()
{
$GLOBALS['OpenDocumentNS'] = "ODNS";
$this->assertTrue(
$this->object->exportHeader()
);
@ -317,18 +318,20 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
$this->assertContains(
"<office:document-content ODNSoffice:version",
$GLOBALS['odt_buffer']
);
);
}
/**
* Test for ExportOdt::exportFooter
*
*
* @return void
*/
public function testExportFooter()
{
$GLOBALS['odt_buffer'] = 'header';
$this->expectOutputRegex('/^PK.*content.xml/');
$this->assertTrue(
$this->object->exportFooter()
);
@ -336,17 +339,17 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
$this->assertContains(
"header",
$GLOBALS['odt_buffer']
);
);
$this->assertContains(
"</office:text></office:body></office:document-content>",
$GLOBALS['odt_buffer']
);
);
}
/**
* Test for ExportOdt::exportDBHeader
*
*
* @return void
*/
public function testExportDBHeader()
@ -360,7 +363,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
$this->assertContains(
"header",
$GLOBALS['odt_buffer']
);
);
$this->assertContains(
"Database d&amp;b</text:h>",
@ -370,7 +373,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOdt::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooter()
@ -382,7 +385,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOdt::exportDBCreate
*
*
* @return void
*/
public function testExportDBCreate()
@ -394,7 +397,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOdt::exportData
*
*
* @return void
*/
public function testExportData()
@ -490,7 +493,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOdt::exportData
*
*
* @return void
*/
public function testExportDataWithFieldNames()
@ -509,7 +512,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
$dbi->expects($this->any())
->method('fieldFlags')
->will($this->returnValue('BINARYTEST'));
$dbi->expects($this->once())
->method('query')
->with('SELECT', null, PMA_DatabaseInterface::QUERY_UNBUFFERED)
@ -615,7 +618,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOdt::getTableDefStandIn
*
*
* @return void
*/
public function testGetTableDefStandIn()
@ -664,7 +667,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOdt::getTableDef
*
*
* @return void
*/
public function testGetTableDef()
@ -704,7 +707,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
->method('getColumns')
->with('database', '')
->will($this->returnValue(array($columns)));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue(true));
@ -751,7 +754,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
true
)
);
$this->assertContains(
'<table:table table:name="_structure"><table:table-column ' .
'table:number-columns-repeated="6"/>',
@ -779,7 +782,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
);
// case 2
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
@ -819,7 +822,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
->method('getColumns')
->with('database', '')
->will($this->returnValue(array($columns)));
$dbi->expects($this->any())
->method('query')
->will($this->returnValue(true));
@ -870,7 +873,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOdt::getTriggers
*
*
* @return void
*/
public function testGetTriggers()
@ -887,7 +890,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
'definition' => 'def'
)
);
$dbi->expects($this->once())
->method('getTriggers')
->with('database', 'ta<ble')
@ -931,12 +934,12 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOdt::exportStructure
*
*
* @return void
*/
public function testExportStructure()
{
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
@ -974,7 +977,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
->will($this->returnValue('dumpText4'));
$GLOBALS['dbi'] = $dbi;
// case 1
$this->assertTrue(
$this->object->exportStructure(
@ -990,7 +993,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
// case 2
$GLOBALS['odt_buffer'] = '';
$this->assertTrue(
$this->object->exportStructure(
'db', 't&bl', "\n", "example.com", "triggers", "test"
@ -1011,7 +1014,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
'db', 't&bl', "\n", "example.com", "create_view", "test"
)
);
$this->assertEquals(
'<text:h text:outline-level="2" text:style-name="Heading_2" ' .
'text:is-list-header="true">Structure for view t&amp;bl</text:h>',
@ -1019,7 +1022,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
);
// case 4
$GLOBALS['odt_buffer'] = '';
$GLOBALS['odt_buffer'] = '';
$this->assertTrue(
$this->object->exportStructure(
'db', 't&bl', "\n", "example.com", "stand_in", "test"
@ -1035,7 +1038,7 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportOdt::formatOneColumnDefinition
*
*
* @return void
*/
public function testFormatOneColumnDefinition()

View File

@ -31,15 +31,16 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
{
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['output_charset_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
$GLOBALS['asfile'] = false;
$GLOBALS['asfile'] = true;
$GLOBALS['save_on_server'] = false;
$this->object = new ExportPdf();
}
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -49,7 +50,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportPdf::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -124,7 +125,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
'MessageOnlyPropertyItem',
$property
);
$this->assertEquals(
'explanation',
$property->getName()
@ -136,7 +137,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
'TextPropertyItem',
$property
);
$this->assertEquals(
'report_title',
$property->getName()
@ -152,7 +153,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportPdf::exportHeader
*
*
* @return void
*/
public function testExportHeader()
@ -160,7 +161,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
$pdf = $this->getMockBuilder('PMA_ExportPdf')
->disableOriginalConstructor()
->getMock();
$pdf->expects($this->once())
->method('Open');
@ -181,7 +182,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportPdf::exportFooter
*
*
* @return void
*/
public function testExportFooter()
@ -189,7 +190,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
$pdf = $this->getMockBuilder('PMA_ExportPdf')
->disableOriginalConstructor()
->getMock();
$pdf->expects($this->once())
->method('getPDFData');
@ -204,7 +205,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportPdf::exportDBHeader
*
*
* @return void
*/
public function testExportDBHeader()
@ -216,7 +217,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportPdf::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooter()
@ -228,7 +229,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportPdf::exportDBCreate
*
*
* @return void
*/
public function testExportDBCreate()
@ -240,7 +241,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportPdf::exportData
*
*
* @return void
*/
public function testExportData()
@ -272,7 +273,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
* Test for
* - ExportPdf::_setPdf
* - ExportPdf::_getPdf
*
*
* @return void
*/
public function testSetGetPdf()
@ -293,7 +294,7 @@ class PMA_ExportPdf_Test extends PHPUnit_Framework_TestCase
* Test for
* - ExportPdf::_setPdfReportTitle
* - ExportPdf::_getPdfReportTitle
*
*
* @return void
*/
public function testSetGetPdfTitle()

View File

@ -6,6 +6,7 @@
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportPhparray.class.php';
require_once 'libraries/DatabaseInterface.class.php';
require_once 'libraries/Util.class.php';
require_once 'libraries/Theme.class.php';
require_once 'libraries/Config.class.php';
@ -30,15 +31,16 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
{
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['output_charset_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
$GLOBALS['asfile'] = false;
$GLOBALS['asfile'] = true;
$GLOBALS['save_on_server'] = false;
$this->object = new ExportPhparray();
}
/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
@ -48,7 +50,7 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportPhparray::setProperties
*
*
* @return void
*/
public function testSetProperties()
@ -123,7 +125,7 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportPhparray::exportHeader
*
*
* @return void
*/
public function testExportHeader()
@ -137,14 +139,14 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
$result = ob_get_clean();
$this->assertContains(
'&lt;?php ',
'<?php ',
$result
);
}
/**
* Test for ExportPhparray::exportFooter
*
*
* @return void
*/
public function testExportFooter()
@ -156,7 +158,7 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportPhparray::exportDBHeader
*
*
* @return void
*/
public function testExportDBHeader()
@ -177,7 +179,7 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportPhparray::exportDBFooter
*
*
* @return void
*/
public function testExportDBFooter()
@ -189,7 +191,7 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportPhparray::exportDBCreate
*
*
* @return void
*/
public function testExportDBCreate()
@ -201,7 +203,7 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
/**
* Test for ExportPhparray::exportData
*
*
* @return void
*/
public function testExportData()
@ -253,7 +255,7 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
"\n" . '// `db`.`table`' . "\n" .
'$table = array(' . "\n" .
' array(\'c1\' =&gt; 1,\'\' =&gt; \'a\')' . "\n" .
' array(\'c1\' => 1,\'\' => \'a\')' . "\n" .
');' . "\n",
$result
);
@ -291,7 +293,7 @@ class PMA_ExportPhparray_Test extends PHPUnit_Framework_TestCase
$this->assertContains(
'$_0_932table',
$result
);
);
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,653 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportTexytext class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportTexytext.class.php';
require_once 'libraries/Util.class.php';
require_once 'libraries/Theme.class.php';
require_once 'libraries/Config.class.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'export.php';
/**
* tests for ExportTexytext class
*
* @package PhpMyAdmin-test
*/
class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
{
protected $object;
/**
* Configures global environment.
*
* @return void
*/
function setup()
{
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
$GLOBALS['asfile'] = false;
$GLOBALS['save_on_server'] = false;
$GLOBALS['plugin_param'] = array();
$GLOBALS['plugin_param']['export_type'] = 'table';
$GLOBALS['plugin_param']['single_table'] = false;
$GLOBALS['cfgRelation']['relation'] = true;
$this->object = new ExportTexytext();
}
/**
* tearDown for test cases
*
* @return void
*/
public function tearDown()
{
unset($this->object);
}
/**
* Test for ExportTexytext::setProperties
*
* @return void
*/
public function testSetProperties()
{
$method = new ReflectionMethod('ExportTexytext', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportTexytext', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
$this->assertInstanceOf(
'ExportPluginProperties',
$properties
);
$this->assertEquals(
'Texy! text',
$properties->getText()
);
$this->assertEquals(
'txt',
$properties->getExtension()
);
$this->assertEquals(
'text/plain',
$properties->getMimeType()
);
$options = $properties->getOptions();
$this->assertInstanceOf(
'OptionsPropertyRootGroup',
$options
);
$this->assertEquals(
'Format Specific Options',
$options->getName()
);
$generalOptionsArray = $options->getProperties();
$generalOptions = array_shift($generalOptionsArray);
$this->assertInstanceOf(
'OptionsPropertyMainGroup',
$generalOptions
);
$this->assertEquals(
'general_opts',
$generalOptions->getName()
);
$this->assertEquals(
"Dump table",
$generalOptions->getText()
);
$generalProperties = $generalOptions->getProperties();
$property = array_shift($generalProperties);
$this->assertInstanceOf(
'RadioPropertyItem',
$property
);
$generalOptions = array_shift($generalOptionsArray);
$this->assertInstanceOf(
'OptionsPropertyMainGroup',
$generalOptions
);
$this->assertEquals(
'data',
$generalOptions->getName()
);
$generalProperties = $generalOptions->getProperties();
$property = array_shift($generalProperties);
$this->assertInstanceOf(
'BoolPropertyItem',
$property
);
$this->assertEquals(
'columns',
$property->getName()
);
$property = array_shift($generalProperties);
$this->assertInstanceOf(
'TextPropertyItem',
$property
);
$this->assertEquals(
'null',
$property->getName()
);
}
/**
* Test for ExportTexytext::exportHeader
*
* @return void
*/
public function testExportHeader()
{
$this->assertTrue(
$this->object->exportHeader()
);
}
/**
* Test for ExportTexytext::exportFooter
*
* @return void
*/
public function testExportFooter()
{
$this->assertTrue(
$this->object->exportFooter()
);
}
/**
* Test for ExportTexytext::exportDBHeader
*
* @return void
*/
public function testExportDBHeader()
{
$this->expectOutputString(
"===Database testDb\n\n"
);
$this->assertTrue(
$this->object->exportDBHeader('testDb')
);
}
/**
* Test for ExportTexytext::exportDBFooter
*
* @return void
*/
public function testExportDBFooter()
{
$this->assertTrue(
$this->object->exportDBFooter('testDB')
);
}
/**
* Test for ExportTexytext::exportDBCreate
*
* @return void
*/
public function testExportDBCreate()
{
$this->assertTrue(
$this->object->exportDBCreate('testDB')
);
}
/**
* Test for ExportTexytext::exportData
*
* @return void
*/
public function testExportData()
{
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->once())
->method('query')
->with('SELECT', null, PMA_DatabaseInterface::QUERY_UNBUFFERED)
->will($this->returnValue(true));
$dbi->expects($this->once())
->method('numFields')
->with(true)
->will($this->returnValue(3));
$dbi->expects($this->at(2))
->method('fieldName')
->will($this->returnValue('fName1'));
$dbi->expects($this->at(3))
->method('fieldName')
->will($this->returnValue('fNa"me2'));
$dbi->expects($this->at(4))
->method('fieldName')
->will($this->returnValue('fName3'));
$dbi->expects($this->at(5))
->method('fetchRow')
->with(true)
->will($this->returnValue(array(null, '0', 'test')));
$GLOBALS['dbi'] = $dbi;
$GLOBALS['what'] = 'foo';
$GLOBALS['foo_columns'] = "&";
$GLOBALS['foo_null'] = ">";
ob_start();
$this->assertTrue(
$this->object->exportData(
'db', 'ta<ble', "\n", "example.com", "SELECT"
)
);
$result = ob_get_clean();
$this->assertContains(
"|fName1|fNa&amp;quot;me2|fName3",
$result
);
$this->assertContains(
"|&amp;gt;|0|test",
$result
);
}
/**
* Test for ExportTexytext::getTableDefStandIn
*
* @return void
*/
public function testGetTableDefStandIn()
{
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->once())
->method('getColumns')
->with('db', 'view')
->will($this->returnValue(array(1, 2)));
$keys = array(
array(
'Non_unique' => 0,
'Column_name' => 'cname'
),
array(
'Non_unique' => 1,
'Column_name' => 'cname2'
)
);
$dbi->expects($this->once())
->method('getTableIndexes')
->with('db', 'view')
->will($this->returnValue($keys));
$dbi->expects($this->once())
->method('selectDb')
->with('db');
$GLOBALS['dbi'] = $dbi;
$this->object = $this->getMockBuilder('ExportTexytext')
->disableOriginalConstructor()
->setMethods(array('formatOneColumnDefinition'))
->getMock();
$this->object->expects($this->at(0))
->method('formatOneColumnDefinition')
->with(1, array('cname'))
->will($this->returnValue('c1'));
$this->object->expects($this->at(1))
->method('formatOneColumnDefinition')
->with(2, array('cname'))
->will($this->returnValue('c2'));
$result = $this->object->getTableDefStandIn('db', 'view', '#');
$this->assertContains(
"c1\nc2",
$result
);
}
/**
* Test for ExportTexytext::getTableDef
*
* @return void
*/
public function testGetTableDef()
{
$this->object = $this->getMockBuilder('ExportTexytext')
->setMethods(array('formatOneColumnDefinition'))
->getMock();
// case 1
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$keys = array(
array(
'Non_unique' => 0,
'Column_name' => 'cname'
),
array(
'Non_unique' => 1,
'Column_name' => 'cname2'
)
);
$dbi->expects($this->once())
->method('getTableIndexes')
->with('db', 'table')
->will($this->returnValue($keys));
$dbi->expects($this->at(2))
->method('fetchResult')
->will(
$this->returnValue(
array(
'fname' => array(
'foreign_table' => '<ftable',
'foreign_field' => 'ffield>'
)
)
)
);
$dbi->expects($this->at(3))
->method('fetchValue')
->will(
$this->returnValue(
'SELECT a FROM b'
)
);
$dbi->expects($this->at(5))
->method('fetchResult')
->will(
$this->returnValue(
array(
'fname' => array(
'values' => 'test-',
'transformation' => 'testfoo',
'mimetype' => 'test<'
)
)
)
);
$columns = array(
'Field' => 'fname',
'Comment' => 'comm'
);
$dbi->expects($this->exactly(2))
->method('getColumns')
->with('db', 'table')
->will($this->returnValue(array($columns)));
$GLOBALS['dbi'] = $dbi;
$this->object->expects($this->exactly(1))
->method('formatOneColumnDefinition')
->with(array('Field' => 'fname', 'Comment' => 'comm'), array('cname'))
->will($this->returnValue(1));
$GLOBALS['cfgRelation']['relation'] = true;
$_SESSION['relation'][0] = array(
'relwork' => true,
'commwork' => true,
'mimework' => true,
'db' => 'db',
'relation' => 'rel',
'column_info' => 'col'
);
$result = $this->object->getTableDef(
'db',
'table',
"\n",
"example.com",
true,
true,
true
);
$this->assertContains(
'1|&lt;ftable (ffield&gt;)|comm|Test&lt;',
$result
);
}
/**
* Test for ExportTexytext::getTriggers
*
* @return void
*/
public function testGetTriggers()
{
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$triggers = array(
array(
'name' => 'tna"me',
'action_timing' => 'ac>t',
'event_manipulation' => 'manip&',
'definition' => 'def'
)
);
$dbi->expects($this->once())
->method('getTriggers')
->with('database', 'ta<ble')
->will($this->returnValue($triggers));
$GLOBALS['dbi'] = $dbi;
$result = $this->object->getTriggers('database', 'ta<ble');
$this->assertContains(
'|tna"me|ac>t|manip&|def',
$result
);
$this->assertContains(
'|Name|Time|Event|Definition',
$result
);
}
/**
* Test for ExportTexytext::exportStructure
*
* @return void
*/
public function testExportStructure()
{
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->once())
->method('getTriggers')
->with('db', 't&bl')
->will($this->returnValue(1));
$this->object = $this->getMockBuilder('ExportTexytext')
->setMethods(array('getTableDef', 'getTriggers', 'getTableDefStandIn'))
->getMock();
$this->object->expects($this->at(0))
->method('getTableDef')
->with('db', 't&bl', "\n", "example.com", false, false, false, false)
->will($this->returnValue('dumpText1'));
$this->object->expects($this->once())
->method('getTriggers')
->with('db', 't&bl')
->will($this->returnValue('dumpText2'));
$this->object->expects($this->at(2))
->method('getTableDef')
->with(
'db', 't&bl', "\n", "example.com",
false, false, false, false, true, true
)
->will($this->returnValue('dumpText3'));
$this->object->expects($this->once())
->method('getTableDefStandIn')
->with('db', 't&bl', "\n")
->will($this->returnValue('dumpText4'));
$GLOBALS['dbi'] = $dbi;
// case 1
ob_start();
$this->assertTrue(
$this->object->exportStructure(
'db', 't&bl', "\n", "example.com", "create_table", "test"
)
);
$result = ob_get_clean();
$this->assertContains(
'== Table structure for table t&amp;bl' . "\n\ndumpText1",
$result
);
// case 2
ob_start();
$this->assertTrue(
$this->object->exportStructure(
'db', 't&bl', "\n", "example.com", "triggers", "test"
)
);
$result = ob_get_clean();
$this->assertEquals(
'== Triggers t&amp;bl' . "\n\ndumpText2",
$result
);
// case 3
ob_start();
$this->assertTrue(
$this->object->exportStructure(
'db', 't&bl', "\n", "example.com", "create_view", "test"
)
);
$result = ob_get_clean();
$this->assertEquals(
'== Structure for view t&amp;bl' . "\n\ndumpText3",
$result
);
// case 4
ob_start();
$this->assertTrue(
$this->object->exportStructure(
'db', 't&bl', "\n", "example.com", "stand_in", "test"
)
);
$result = ob_get_clean();
$this->assertEquals(
'== Stand-in structure for view t&amp;bl' . "\n\ndumpText4",
$result
);
}
/**
* Test for ExportTexytext::formatOneColumnDefinition
*
* @return void
*/
public function testFormatOneColumnDefinition()
{
$GLOBALS['cfg']['LimitChars'] = 40;
$cols = array(
'Null' => 'Yes',
'Field' => 'field',
'Key' => 'PRI',
'Type' => 'set(abc)enum123'
);
$unique_keys = array(
'field'
);
$this->assertEquals(
'|//**field**//|set(abc)|Yes|NULL',
$this->object->formatOneColumnDefinition($cols, $unique_keys)
);
$cols = array(
'Null' => 'NO',
'Field' => 'fields',
'Key' => 'COMP',
'Type' => '',
'Default' => 'def'
);
$unique_keys = array(
'field'
);
$this->assertEquals(
'|fields|&amp;nbsp;|No|def',
$this->object->formatOneColumnDefinition($cols, $unique_keys)
);
}
}
?>

View File

@ -0,0 +1,704 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportXml class
*
* @package PhpMyAdmin-test
*/
$GLOBALS['db'] = 'db';
require_once 'libraries/plugins/export/ExportXml.class.php';
require_once 'libraries/Util.class.php';
require_once 'libraries/Theme.class.php';
require_once 'libraries/Config.class.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'export.php';
/**
* tests for ExportXml class
*
* @package PhpMyAdmin-test
*/
class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
{
protected $object;
/**
* Configures global environment.
*
* @return void
*/
function setup()
{
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
$GLOBALS['asfile'] = false;
$GLOBALS['save_on_server'] = false;
$GLOBALS['plugin_param'] = array();
$GLOBALS['plugin_param']['export_type'] = 'table';
$GLOBALS['plugin_param']['single_table'] = false;
$GLOBALS['cfgRelation']['relation'] = true;
$this->object = new ExportXml();
}
/**
* tearDown for test cases
*
* @return void
*/
public function tearDown()
{
unset($this->object);
}
/**
* Test for ExportXml::setProperties
*
* @return void
*/
public function testSetProperties()
{
$restoreDrizzle = 'PMANORESTORE';
if (PMA_DRIZZLE) {
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped(
"Cannot redefine constant. Missing runkit extension"
);
} else {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', false);
}
}
$method = new ReflectionMethod('ExportXml', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportXml', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
$this->assertInstanceOf(
'ExportPluginProperties',
$properties
);
$this->assertEquals(
'XML',
$properties->getText()
);
$this->assertEquals(
'xml',
$properties->getExtension()
);
$this->assertEquals(
'text/xml',
$properties->getMimeType()
);
$options = $properties->getOptions();
$this->assertInstanceOf(
'OptionsPropertyRootGroup',
$options
);
$this->assertEquals(
'Format Specific Options',
$options->getName()
);
$generalOptionsArray = $options->getProperties();
$generalOptions = array_shift($generalOptionsArray);
$this->assertInstanceOf(
'OptionsPropertyMainGroup',
$generalOptions
);
$this->assertEquals(
'general_opts',
$generalOptions->getName()
);
$generalProperties = $generalOptions->getProperties();
$property = array_shift($generalProperties);
$this->assertInstanceOf(
'HiddenPropertyItem',
$property
);
$generalOptions = array_shift($generalOptionsArray);
$this->assertInstanceOf(
'OptionsPropertyMainGroup',
$generalOptions
);
$this->assertEquals(
'structure',
$generalOptions->getName()
);
$generalProperties = $generalOptions->getProperties();
$property = array_shift($generalProperties);
$this->assertInstanceOf(
'BoolPropertyItem',
$property
);
$property = array_shift($generalProperties);
$this->assertInstanceOf(
'BoolPropertyItem',
$property
);
$property = array_shift($generalProperties);
$this->assertInstanceOf(
'BoolPropertyItem',
$property
);
$property = array_shift($generalProperties);
$this->assertInstanceOf(
'BoolPropertyItem',
$property
);
$property = array_shift($generalProperties);
$this->assertInstanceOf(
'BoolPropertyItem',
$property
);
$generalOptions = array_shift($generalOptionsArray);
$this->assertInstanceOf(
'OptionsPropertyMainGroup',
$generalOptions
);
$this->assertEquals(
'data',
$generalOptions->getName()
);
$generalProperties = $generalOptions->getProperties();
$property = array_shift($generalProperties);
$this->assertInstanceOf(
'BoolPropertyItem',
$property
);
if ($restoreDrizzle !== "PMANORESTORE") {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
}
/**
* Test for ExportXml::exportHeader
*
* @return void
*/
public function testExportHeaderWithoutDrizzle()
{
$restoreDrizzle = 'PMANORESTORE';
if (PMA_DRIZZLE) {
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped(
"Cannot redefine constant. Missing runkit extension"
);
} else {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', false);
}
}
$GLOBALS['xml_export_functions'] = 1;
$GLOBALS['xml_export_contents'] = 1;
$GLOBALS['output_charset_conversion'] = 1;
$GLOBALS['charset_of_file'] = 'iso-8859-1';
$GLOBALS['cfg']['Server']['port'] = 80;
$GLOBALS['cfg']['Server']['host'] = 'localhost';
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['xml_export_tables'] = 1;
$GLOBALS['xml_export_triggers'] = 1;
$GLOBALS['xml_export_procedures'] = 1;
$GLOBALS['xml_export_functions'] = 1;
$GLOBALS['crlf'] = "\n";
$GLOBALS['db'] = 'd<"b';
$result = array(
0 => array(
'DEFAULT_COLLATION_NAME' => 'utf8_general_ci',
'DEFAULT_CHARACTER_SET_NAME' => 'utf-8',
),
'table' => array(null, '"tbl"')
);
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->at(0))
->method('fetchResult')
->with(
'SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME`'
. ' FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME`'
. ' = \'d<"b\' LIMIT 1'
)
->will($this->returnValue($result));
$dbi->expects($this->at(1))
->method('fetchResult')
->with(
'SHOW CREATE TABLE `d<"b`.`table`',
0
)
->will($this->returnValue($result));
// isView
$dbi->expects($this->at(2))
->method('fetchResult')
->will($this->returnValue(false));
$dbi->expects($this->at(3))
->method('getTriggers')
->with('d<"b', 'table')
->will(
$this->returnValue(
array(
array(
'create' => 'crt',
'name' => 'trname'
)
)
)
);
$dbi->expects($this->at(4))
->method('getProceduresOrFunctions')
->with('d<"b', 'FUNCTION')
->will(
$this->returnValue(
array(
'fn'
)
)
);
$dbi->expects($this->at(5))
->method('getDefinition')
->with('d<"b', 'FUNCTION', 'fn')
->will(
$this->returnValue(
'fndef'
)
);
$dbi->expects($this->at(6))
->method('getProceduresOrFunctions')
->with('d<"b', 'PROCEDURE')
->will(
$this->returnValue(
array(
'pr'
)
)
);
$dbi->expects($this->at(7))
->method('getDefinition')
->with('d<"b', 'PROCEDURE', 'pr')
->will(
$this->returnValue(
'prdef'
)
);
$GLOBALS['dbi'] = $dbi;
$GLOBALS['tables'] = array();
$GLOBALS['table'] = 'table';
ob_start();
$this->assertTrue(
$this->object->exportHeader()
);
$result = ob_get_clean();
$this->assertContains(
'&lt;pma_xml_export version=&quot;1.0&quot; xmlns:pma=&quot;' .
'http://www.phpmyadmin.net/some_doc_url/&quot;&gt;',
$result
);
$this->assertContains(
'&lt;pma:structure_schemas&gt;' . "\n" .
' &lt;pma:database name=&quot;d&amp;lt;&amp;quot;b&quot; collat' .
'ion=&quot;utf8_general_ci&quot; charset=&quot;utf-8&quot;&gt;' . "\n" .
' &lt;pma:table name=&quot;table&quot;&gt;' . "\n" .
' &amp;quot;tbl&amp;quot;;' . "\n" .
' &lt;/pma:table&gt;' . "\n" .
' &lt;pma:trigger name=&quot;trname&quot;&gt;' . "\n" .
' ' . "\n" .
' &lt;/pma:trigger&gt;' . "\n" .
' &lt;pma:function name=&quot;fn&quot;&gt;' . "\n" .
' fndef' . "\n" .
' &lt;/pma:function&gt;' . "\n" .
' &lt;pma:procedure name=&quot;pr&quot;&gt;' . "\n" .
' prdef' . "\n" .
' &lt;/pma:procedure&gt;' . "\n" .
' &lt;/pma:database&gt;' . "\n" .
' &lt;/pma:structure_schemas&gt;',
$result
);
// case 2 with isView as true and false
unset($GLOBALS['xml_export_contents']);
unset($GLOBALS['xml_export_views']);
unset($GLOBALS['xml_export_tables']);
unset($GLOBALS['xml_export_functions']);
unset($GLOBALS['xml_export_procedures']);
$GLOBALS['output_charset_conversion'] = 0;
$result = array(
array(
'DEFAULT_COLLATION_NAME' => 'utf8_general_ci',
'DEFAULT_CHARACTER_SET_NAME' => 'utf-8',
)
);
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->at(0))
->method('fetchResult')
->with(
'SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME`'
. ' FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME`'
. ' = \'d<"b\' LIMIT 1'
)
->will($this->returnValue($result));
$result = array(
't1' => array(null, '"tbl"')
);
$dbi->expects($this->at(1))
->method('fetchResult')
->with(
'SHOW CREATE TABLE `d<"b`.`t1`',
0
)
->will($this->returnValue($result));
// isView
$dbi->expects($this->at(2))
->method('fetchResult')
->will($this->returnValue(true));
$result = array(
't2' => array(null, '"tbl"')
);
$dbi->expects($this->at(3))
->method('fetchResult')
->with(
'SHOW CREATE TABLE `d<"b`.`t2`',
0
)
->will($this->returnValue($result));
// isView
$dbi->expects($this->at(4))
->method('fetchResult')
->will($this->returnValue(false));
$GLOBALS['dbi'] = $dbi;
$GLOBALS['tables'] = array('t1', 't2');
ob_start();
$this->assertTrue(
$this->object->exportHeader()
);
$result = ob_get_clean();
//echo $result; die;
$this->assertContains(
'&lt;pma:structure_schemas&gt;' . "\n" .
' &lt;pma:database name=&quot;d&amp;lt;&amp;quot;b&quot; collat' .
'ion=&quot;utf8_general_ci&quot; charset=&quot;utf-8&quot;&gt;' . "\n" .
' &lt;/pma:database&gt;' . "\n" .
' &lt;/pma:structure_schemas&gt;',
$result
);
if ($restoreDrizzle !== "PMANORESTORE") {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
}
/**
* Test for ExportXml::exportHeader
*
* @return void
*/
public function testExportHeaderWithDrizzle()
{
$restoreDrizzle = 'PMANORESTORE';
if (!PMA_DRIZZLE) {
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped(
"Cannot redefine constant. Missing runkit extension"
);
} else {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', true);
}
}
$GLOBALS['output_charset_conversion'] = false;
$GLOBALS['xml_export_triggers'] = true;
$GLOBALS['cfg']['Server']['port'] = 80;
$GLOBALS['cfg']['Server']['host'] = 'localhost';
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['crlf'] = "\n";
$GLOBALS['db'] = 'd<b';
$result = array(
0 => array(
'DEFAULT_COLLATION_NAME' => 'utf8_general_ci',
'DEFAULT_CHARACTER_SET_NAME' => 'utf-8',
),
'table' => array(null, '"tbl"')
);
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->at(0))
->method('fetchResult')
->with(
"SELECT
'utf8' AS DEFAULT_CHARACTER_SET_NAME,
DEFAULT_COLLATION_NAME
FROM data_dictionary.SCHEMAS
WHERE SCHEMA_NAME = 'd<b'"
)
->will($this->returnValue($result));
$dbi->expects($this->at(1))
->method('fetchResult')
->with(
'SHOW CREATE TABLE `d<b`.`table`',
0
)
->will($this->returnValue($result));
// isView
$dbi->expects($this->at(2))
->method('fetchResult')
->will($this->returnValue(false));
$GLOBALS['dbi'] = $dbi;
$GLOBALS['tables'] = array();
$GLOBALS['table'] = 'table';
ob_start();
$this->assertTrue(
$this->object->exportHeader()
);
$result = ob_get_clean();
if ($restoreDrizzle !== "PMANORESTORE") {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
}
/**
* Test for ExportXml::exportFooter
*
* @return void
*/
public function testExportFooter()
{
$this->expectOutputString(
'&lt;/pma_xml_export&gt;'
);
$this->assertTrue(
$this->object->exportFooter()
);
}
/**
* Test for ExportXml::exportDBHeader
*
* @return void
*/
public function testExportDBHeader()
{
$GLOBALS['xml_export_contents'] = true;
ob_start();
$this->assertTrue(
$this->object->exportDBHeader('&db')
);
$result = ob_get_clean();
$this->assertContains(
'&lt;database name=&quot;&amp;amp;db&quot;&gt;',
$result
);
$GLOBALS['xml_export_contents'] = false;
$this->assertTrue(
$this->object->exportDBHeader('&db')
);
}
/**
* Test for ExportXml::exportDBFooter
*
* @return void
*/
public function testExportDBFooter()
{
$GLOBALS['xml_export_contents'] = true;
ob_start();
$this->assertTrue(
$this->object->exportDBFooter('&db')
);
$result = ob_get_clean();
$this->assertContains(
'&lt;/database&gt;',
$result
);
$GLOBALS['xml_export_contents'] = false;
$this->assertTrue(
$this->object->exportDBFooter('&db')
);
}
/**
* Test for ExportXml::exportDBCreate
*
* @return void
*/
public function testExportDBCreate()
{
$this->assertTrue(
$this->object->exportDBCreate('testDB')
);
}
/**
* Test for ExportXml::exportData
*
* @return void
*/
public function testExportData()
{
$GLOBALS['xml_export_contents'] = true;
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->once())
->method('query')
->with('SELECT', null, PMA_DatabaseInterface::QUERY_UNBUFFERED)
->will($this->returnValue(true));
$dbi->expects($this->once())
->method('numFields')
->with(true)
->will($this->returnValue(3));
$dbi->expects($this->at(2))
->method('fieldName')
->will($this->returnValue('fName1'));
$dbi->expects($this->at(3))
->method('fieldName')
->will($this->returnValue('fNa"me2'));
$dbi->expects($this->at(4))
->method('fieldName')
->will($this->returnValue('fNa\\me3'));
$dbi->expects($this->at(5))
->method('fetchRow')
->with(true)
->will($this->returnValue(array(null, '<a>')));
$GLOBALS['dbi'] = $dbi;
ob_start();
$this->assertTrue(
$this->object->exportData(
'db', 'ta<ble', "\n", "example.com", "SELECT"
)
);
$result = ob_get_clean();
$this->assertContains(
"&lt;!-- Table ta&lt;ble --&gt;",
$result
);
$this->assertContains(
"&lt;table name=&quot;ta&amp;lt;ble&quot;&gt;",
$result
);
$this->assertContains(
"&lt;column name=&quot;fName1&quot;&gt;NULL&lt;/column&gt;",
$result
);
$this->assertContains(
"&lt;column name=&quot;fNa&amp;quot;me2&quot;&gt;&amp;lt;a&amp;gt;" .
"&lt;/column&gt;",
$result
);
$this->assertContains(
"&lt;column name=&quot;fName3&quot;&gt;NULL&lt;/column&gt;",
$result
);
$this->assertContains(
"&lt;/table&gt;",
$result
);
}
}
?>

View File

@ -0,0 +1,267 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ExportYaml class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/ExportYaml.class.php';
require_once 'libraries/Util.class.php';
require_once 'libraries/Theme.class.php';
require_once 'libraries/Config.class.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
require_once 'export.php';
/**
* tests for ExportYaml class
*
* @package PhpMyAdmin-test
*/
class PMA_ExportYaml_Test extends PHPUnit_Framework_TestCase
{
protected $object;
/**
* Configures global environment.
*
* @return void
*/
function setup()
{
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
$GLOBALS['asfile'] = false;
$GLOBALS['save_on_server'] = false;
$GLOBALS['crlf'] = "\n";
$GLOBALS['cfgRelation']['relation'] = true;
$this->object = new ExportYaml();
}
/**
* tearDown for test cases
*
* @return void
*/
public function tearDown()
{
unset($this->object);
}
/**
* Test for ExportYaml::setProperties
*
* @return void
*/
public function testSetProperties()
{
$method = new ReflectionMethod('ExportYaml', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportYaml', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
$this->assertInstanceOf(
'ExportPluginProperties',
$properties
);
$this->assertEquals(
'YAML',
$properties->getText()
);
$this->assertEquals(
'yml',
$properties->getExtension()
);
$this->assertEquals(
'text/yaml',
$properties->getMimeType()
);
$options = $properties->getOptions();
$this->assertInstanceOf(
'OptionsPropertyRootGroup',
$options
);
$this->assertEquals(
'Format Specific Options',
$options->getName()
);
$generalOptionsArray = $options->getProperties();
$generalOptions = array_shift($generalOptionsArray);
$this->assertInstanceOf(
'OptionsPropertyMainGroup',
$generalOptions
);
$this->assertEquals(
'general_opts',
$generalOptions->getName()
);
$generalProperties = $generalOptions->getProperties();
$property = array_shift($generalProperties);
$this->assertInstanceOf(
'HiddenPropertyItem',
$property
);
}
/**
* Test for ExportYaml::exportHeader
*
* @return void
*/
public function testExportHeader()
{
ob_start();
$this->assertTrue(
$this->object->exportHeader()
);
$result = ob_get_clean();
$this->assertContains(
"%YAML 1.1\n---\n",
$result
);
}
/**
* Test for ExportYaml::exportFooter
*
* @return void
*/
public function testExportFooter()
{
$this->expectOutputString(
"...\n"
);
$this->assertTrue(
$this->object->exportFooter()
);
}
/**
* Test for ExportYaml::exportDBHeader
*
* @return void
*/
public function testExportDBHeader()
{
$this->assertTrue(
$this->object->exportDBHeader('&db')
);
}
/**
* Test for ExportYaml::exportDBFooter
*
* @return void
*/
public function testExportDBFooter()
{
$this->assertTrue(
$this->object->exportDBFooter('&db')
);
}
/**
* Test for ExportYaml::exportDBCreate
*
* @return void
*/
public function testExportDBCreate()
{
$this->assertTrue(
$this->object->exportDBCreate('testDB')
);
}
/**
* Test for ExportYaml::exportData
*
* @return void
*/
public function testExportData()
{
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->once())
->method('query')
->with('SELECT', null, PMA_DatabaseInterface::QUERY_UNBUFFERED)
->will($this->returnValue(true));
$dbi->expects($this->once())
->method('numFields')
->with(true)
->will($this->returnValue(4));
$dbi->expects($this->at(2))
->method('fieldName')
->will($this->returnValue('fName1'));
$dbi->expects($this->at(3))
->method('fieldName')
->will($this->returnValue('fNa"me2'));
$dbi->expects($this->at(4))
->method('fieldName')
->will($this->returnValue('fNa\\me3'));
$dbi->expects($this->at(5))
->method('fieldName')
->will($this->returnValue('fName4'));
$dbi->expects($this->at(6))
->method('fetchRow')
->with(true)
->will(
$this->returnValue(
array(null, '123', "\"c\\a\nb\r")
)
);
$dbi->expects($this->at(7))
->method('fetchRow')
->with(true)
->will(
$this->returnValue(
array(null)
)
);
$GLOBALS['dbi'] = $dbi;
ob_start();
$this->assertTrue(
$this->object->exportData(
'db', 'ta<ble', "\n", "example.com", "SELECT"
)
);
$result = ob_get_clean();
$this->assertEquals(
'# db.ta&lt;ble' . "\n" .
'-' . "\n" .
' fNa&quot;me2: 123' . "\n" .
' fName3: &quot;\&quot;c\\\\a\nb\r&quot;' . "\n" .
'-' . "\n",
$result
);
}
}
?>

View File

@ -0,0 +1,346 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for TableProperty class
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/plugins/export/TableProperty.class.php';
require_once 'libraries/Util.class.php';
require_once 'libraries/Theme.class.php';
require_once 'libraries/Config.class.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/config.default.php';
/**
* tests for TableProperty class
*
* @package PhpMyAdmin-test
*/
class PMA_TableProperty_Test extends PHPUnit_Framework_TestCase
{
protected $object;
/**
* Configures global environment.
*
* @return void
*/
function setup()
{
$GLOBALS['server'] = 0;
$row = array(' name ', 'int ', true, ' PRI', '0', 'mysql');
$this->object = new TableProperty($row);
}
/**
* tearDown for test cases
*
* @return void
*/
public function tearDown()
{
unset($this->object);
}
/**
* Test for TableProperty::__construct
*
* @return void
*/
public function testConstructor()
{
$this->assertEquals(
'name',
$this->object->name
);
$this->assertEquals(
'int',
$this->object->type
);
$this->assertEquals(
1,
$this->object->nullable
);
$this->assertEquals(
'PRI',
$this->object->key
);
$this->assertEquals(
'0',
$this->object->defaultValue
);
$this->assertEquals(
'mysql',
$this->object->ext
);
}
/**
* Test for TableProperty::getPureType
*
* @return void
*/
public function testGetPureType()
{
$this->object->type = "int(10)";
$this->assertEquals(
"int",
$this->object->getPureType()
);
$this->object->type = "char";
$this->assertEquals(
"char",
$this->object->getPureType()
);
}
/**
* Test for TableProperty::isNotNull
*
* @param string $nullable nullable value
* @param string $expected expected output
*
* @return void
* @dataProvider isNotNullProvider
*/
public function testIsNotNull($nullable, $expected)
{
$this->object->nullable = $nullable;
$this->assertEquals(
$expected,
$this->object->isNotNull()
);
}
/**
* Data provider for testIsNotNull
*
* @return array Test Data
*/
public function isNotNullProvider()
{
return array(
array("NO", "true"),
array("", "false"),
array("no", "false")
);
}
/**
* Test for TableProperty::isUnique
*
* @param string $key key value
* @param string $expected expected output
*
* @return void
* @dataProvider isUniqueProvider
*/
public function testIsUnique($key, $expected)
{
$this->object->key = $key;
$this->assertEquals(
$expected,
$this->object->isUnique()
);
}
/**
* Data provider for testIsUnique
*
* @return array Test Data
*/
public function isUniqueProvider()
{
return array(
array("PRI", "true"),
array("UNI", "true"),
array("", "false"),
array("pri", "false"),
array("uni", "false"),
);
}
/**
* Test for TableProperty::getDotNetPrimitiveType
*
* @param string $type type value
* @param string $expected expected output
*
* @return void
* @dataProvider getDotNetPrimitiveTypeProvider
*/
public function testGetDotNetPrimitiveType($type, $expected)
{
$this->object->type = $type;
$this->assertEquals(
$expected,
$this->object->getDotNetPrimitiveType()
);
}
/**
* Data provider for testGetDotNetPrimitiveType
*
* @return array Test Data
*/
public function getDotNetPrimitiveTypeProvider()
{
return array(
array("int", "int"),
array("long", "long"),
array("char", "string"),
array("varchar", "string"),
array("text", "string"),
array("longtext", "long"), // TODO: seemingly wrong, should be string
array("tinyint", "bool"),
array("datetime", "DateTime"),
array("", "unknown"),
array("dummy", "unknown"),
array("INT", "unknown")
);
}
/**
* Test for TableProperty::getDotNetObjectType
*
* @param string $type type value
* @param string $expected expected output
*
* @return void
* @dataProvider getDotNetObjectTypeProvider
*/
public function testGetDotNetObjectType($type, $expected)
{
$this->object->type = $type;
$this->assertEquals(
$expected,
$this->object->getDotNetObjectType()
);
}
/**
* Data provider for testGetDotNetObjectType
*
* @return array Test Data
*/
public function getDotNetObjectTypeProvider()
{
return array(
array("int", "Int32"),
array("long", "Long"),
array("char", "String"),
array("varchar", "String"),
array("text", "String"),
array("longtext", "Long"), // TODO: seemingly wrong, should be string
array("tinyint", "Boolean"),
array("datetime", "DateTime"),
array("", "Unknown"),
array("dummy", "Unknown"),
array("INT", "Unknown")
);
}
/**
* Test for TableProperty::getIndexName
*
* @return void
*/
public function testGetIndexName()
{
$this->object->name = "ä'7<ab>";
$this->object->key = "PRI";
$this->assertEquals(
"index=\"ä'7&lt;ab&gt;\"",
$this->object->getIndexName()
);
$this->object->key = "";
$this->assertEquals(
"",
$this->object->getIndexName()
);
}
/**
* Test for TableProperty::isPK
*
* @return void
*/
public function testIsPK()
{
$this->object->key = "PRI";
$this->assertTrue(
$this->object->isPK()
);
$this->object->key = "";
$this->assertFalse(
$this->object->isPK()
);
}
/**
* Test for TableProperty::formatCs
*
* @return void
*/
public function testFormatCs()
{
$this->object->name = 'Name#name#123';
$this->assertEquals(
'text123Namename',
$this->object->formatCs("text123#name#")
);
}
/**
* Test for TableProperty::formatXml
*
* @return void
*/
public function testFormatXml()
{
$this->object->name = '"a\'';
$this->assertEquals(
'&quot;a\'index="&quot;a\'"',
$this->object->formatXml("#name##indexName#")
);
}
/**
* Test for TableProperty::format
*
* @return void
*/
public function testFormat()
{
$this->assertEquals(
'NameintInt32intfalsetrue',
$this->object->format(
"#ucfirstName##dotNetPrimitiveType##dotNetObjectType##type#" .
"#notNull##unique#"
)
);
}
}
?>

View File

@ -16,6 +16,7 @@ require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/Index.class.php';
require_once 'libraries/Table.class.php';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/transformations.lib.php';
require_once 'libraries/schema/Pdf_Relation_Schema.class.php';
/**
@ -51,6 +52,8 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$_POST['with_doc'] = 'on';
$GLOBALS['server'] = 1;
$GLOBALS['controllink'] = null;
$GLOBALS['db'] = 'information_schema';
$GLOBALS['cfg']['Server']['pmadb'] = "pmadb";
$GLOBALS['cfg']['LimitChars'] = 100;
$GLOBALS['cfg']['ServerDefault'] = 1;
@ -58,11 +61,20 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
$GLOBALS['cfg']['Server']['bookmarktable'] = "bookmarktable";
$GLOBALS['cfg']['Server']['relation'] = "relation";
$GLOBALS['cfg']['Server']['relation'] = "relation";
$GLOBALS['cfg']['Server']['table_info'] = "table_info";
$GLOBALS['cfgRelation']['db'] = "PMA";
$GLOBALS['cfgRelation']['table_coords'] = "table_name";
//_SESSION
$_SESSION['relation'][$GLOBALS['server']] = array(
'table_coords' => "table_name",
'displaywork' => 'displaywork',
'db' => "information_schema",
'table_info' => 'table_info',
'relwork' => false,
'relation' => 'relation',
'mimework' => 'mimework',
'commwork' => 'commwork',
'column_info' => 'column_info'
);
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
@ -79,15 +91,24 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
$dbi->expects($this->any())
->method('tryQuery')
->will($this->returnValue("executed_1"));
$fetchArrayReturn = array(
'table_name' => 'pma_table_name'
//table name in information_schema_relations
'table_name' => 'CHARACTER_SETS'
);
$fetchArrayReturn2 = array(
//table name in information_schema_relations
'table_name' => 'COLLATIONS'
);
$dbi->expects($this->at(2))
->method('fetchAssoc')
->will($this->returnValue($fetchArrayReturn));
$dbi->expects($this->at(3))
->method('fetchAssoc')
->will($this->returnValue($fetchArrayReturn2));
$dbi->expects($this->at(4))
->method('fetchAssoc')
->will($this->returnValue(false));
@ -142,10 +163,19 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
. "COLLATE=utf8_bin COMMENT='Bookmarks'";
$dbi->expects($this->once())
$dbi->expects($this->any())
->method('fetchValue')
->will($this->returnValue($fetchValue));
$fetchResult = array(
'column1' => array('mimetype' => 'value1', 'transformation'=> 'pdf'),
'column2' => array('mimetype' => 'value2', 'transformation'=> 'xml'),
);
$dbi->expects($this->any())->method('fetchResult')
->will($this->returnValue($fetchResult));
$GLOBALS['dbi'] = $dbi;
$this->object = new PMA_Pdf_Relation_Schema();

View File

@ -19,6 +19,7 @@ require_once 'libraries/sanitizing.lib.php';
require_once 'libraries/sqlparser.lib.php';
require_once 'libraries/js_escape.lib.php';
require_once 'libraries/Message.class.php';
require_once 'libraries/Response.class.php';
require_once 'libraries/server_privileges.lib.php';
/**
@ -51,6 +52,7 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
$GLOBALS['cfg']['LimitChars'] = 100;
$GLOBALS['cfg']['DBG']['sql'] = false;
$GLOBALS['cfg']['AllowThirdPartyFraming'] = false;
$GLOBALS['table'] = "table";
$GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
@ -79,11 +81,110 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
)
);
$fetchSingleRow = array('password' => 'pma_password');
$dbi->expects($this->any())->method('fetchSingleRow')
->will($this->returnValue($fetchSingleRow));
$fetchValue = array('key1' => 'value1');
$dbi->expects($this->any())->method('fetchValue')
->will($this->returnValue($fetchValue));
$dbi->expects($this->any())->method('tryQuery')
->will($this->returnValue(true));
$GLOBALS['dbi'] = $dbi;
}
/**
* Test for PMA_getHtmlForExportUserDefinition
* Test for PMA_getDataForDBInfo
*
* @return void
*/
public function testPMAGetDataForDBInfo()
{
$_REQUEST['tablename'] = "PMA_tablename";
$_REQUEST['dbname'] = "PMA_dbname";
list($dbname, $tablename, $db_and_table, $dbname_is_wildcard)
= PMA_getDataForDBInfo();
$this->assertEquals(
"PMA_dbname",
$dbname
);
$this->assertEquals(
"PMA_tablename",
$tablename
);
$this->assertEquals(
"`PMA_dbname`.`PMA_tablename`",
$db_and_table
);
$this->assertEquals(
true,
$dbname_is_wildcard
);
//pre variable have been defined
$_REQUEST['pred_tablename'] = "PMA_pred__tablename";
$_REQUEST['pred_dbname'] = "PMA_pred_dbname";
list($dbname, $tablename, $db_and_table, $dbname_is_wildcard)
= PMA_getDataForDBInfo();
$this->assertEquals(
"PMA_pred_dbname",
$dbname
);
$this->assertEquals(
"PMA_pred__tablename",
$tablename
);
$this->assertEquals(
"`PMA_pred_dbname`.`PMA_pred__tablename`",
$db_and_table
);
$this->assertEquals(
true,
$dbname_is_wildcard
);
}
/**
* Test for PMA_getDataForChangeOrCopyUser
*
* @return void
*/
public function testPMAGetDataForChangeOrCopyUser()
{
//$_REQUEST['change_copy'] not set
list($queries, $password) = PMA_getDataForChangeOrCopyUser();
$this->assertEquals(
null,
$queries
);
$this->assertEquals(
null,
$queries
);
//$_REQUEST['change_copy'] is set
$_REQUEST['change_copy'] = true;
$_REQUEST['old_username'] = 'PMA_old_username';
$_REQUEST['old_hostname'] = 'PMA_old_hostname';
list($queries, $password) = PMA_getDataForChangeOrCopyUser();
$this->assertEquals(
'pma_password',
$password
);
$this->assertEquals(
array(),
$queries
);
unset($_REQUEST['change_copy']);
}
/**
* Test for PMA_getListForExportUserDefinition
*
* @return void
*/
@ -98,7 +199,7 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfg']['TextareaRows'] = 'TextareaCols';
list($title, $export)
= PMA_getHtmlForExportUserDefinition($username, $hostname);
= PMA_getListForExportUserDefinition($username, $hostname);
//validate 1: $export
$result = '<textarea class="export" cols="' . $GLOBALS['cfg']['TextareaCols']
@ -125,6 +226,184 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
);
}
/**
* Test for PMA_getSqlQueriesForDisplayAndAddUser
*
* @return void
*/
public function testPMAGetSqlQueriesForDisplayAndAddNewUser()
{
$dbname = 'pma_dbname';
$username = 'pma_username';
$hostname = 'pma_hostname';
$dbname = 'pma_dbname';
$password = 'pma_password';
$_REQUEST['adduser_submit'] = true;
$_POST['pred_username'] = 'any';
$_POST['pred_hostname'] = 'localhost';
$_REQUEST['createdb-3'] = true;
list($create_user_real, $create_user_show, $real_sql_query, $sql_query)
= PMA_getSqlQueriesForDisplayAndAddUser(
$username, $hostname,
(isset ($password) ? $password : '')
);
$this->assertEquals(
"CREATE USER 'pma_username'@'pma_hostname';",
$create_user_real
);
$this->assertEquals(
"CREATE USER 'pma_username'@'pma_hostname';",
$create_user_show
);
$this->assertEquals(
"GRANT USAGE ON *.* TO 'pma_username'@'pma_hostname';",
$real_sql_query
);
$this->assertEquals(
"GRANT USAGE ON *.* TO 'pma_username'@'pma_hostname';",
$sql_query
);
}
/**
* Test for PMA_addUser
*
* @return void
*/
public function testPMAAddUser()
{
$dbname = 'pma_dbname';
$username = 'pma_username';
$hostname = 'pma_hostname';
$tablename = 'pma_tablename';
$password = 'pma_password';
$_REQUEST['adduser_submit'] = true;
$_POST['pred_username'] = 'any';
$_POST['pred_hostname'] = 'localhost';
$_REQUEST['createdb-3'] = true;
list(
$ret_message, $ret_queries,
$queries_for_display, $sql_query,
$_add_user_error
) = PMA_addUser(
$dbname,
$username,
$hostname,
$dbname,
true
);
$this->assertEquals(
'You have added a new user.',
$ret_message->getMessage()
);
$this->assertEquals(
"CREATE USER ''@'localhost';GRANT USAGE ON *.* TO ''@'localhost';"
. "GRANT ALL PRIVILEGES ON `pma_dbname`.* TO ''@'localhost';",
$sql_query
);
$this->assertEquals(
false,
$_add_user_error
);
}
/**
* Test for PMA_updatePassword
*
* @return void
*/
public function testPMAUpdatePassword()
{
$dbname = 'pma_dbname';
$db_and_table = 'pma_dbname.pma_tablename';
$username = 'pma_username';
$hostname = 'pma_hostname';
$tablename = 'pma_tablename';
$password = 'pma_password';
$err_url = "error.php";
$_POST['pma_pw'] = 'pma_pw';
$message = PMA_updatePassword(
$err_url, $username, $hostname
);
$this->assertEquals(
"The password for 'pma_username'@'pma_hostname' "
. "was changed successfully.",
$message->getMessage()
);
}
/**
* Test for PMA_getMessageAndSqlQueryForPrivilegesRevoke
*
* @return void
*/
public function testPMAGetMessageAndSqlQueryForPrivilegesRevoke()
{
$dbname = 'pma_dbname';
$db_and_table = 'pma_dbname.pma_tablename';
$username = 'pma_username';
$hostname = 'pma_hostname';
$tablename = 'pma_tablename';
$password = 'pma_password';
$_REQUEST['adduser_submit'] = true;
$_POST['pred_username'] = 'any';
$_POST['pred_hostname'] = 'localhost';
$_REQUEST['createdb-3'] = true;
$_POST['Grant_priv'] = 'Y';
$_POST['max_questions'] = 1000;
list ($message, $sql_query)
= PMA_getMessageAndSqlQueryForPrivilegesRevoke(
$db_and_table, $dbname, $tablename, $username, $hostname
);
$this->assertEquals(
"You have revoked the privileges for 'pma_username'@'pma_hostname'",
$message->getMessage()
);
$this->assertEquals(
"REVOKE ALL PRIVILEGES ON `pma_dbname`.`pma_tablename` "
. "FROM 'pma_username'@'pma_hostname'; "
. "REVOKE GRANT OPTION ON `pma_dbname`.`pma_tablename` "
. "FROM 'pma_username'@'pma_hostname';",
$sql_query
);
}
/**
* Test for PMA_updatePrivileges
*
* @return void
*/
public function testPMAUpdatePrivileges()
{
$dbname = 'pma_dbname';
$username = 'pma_username';
$hostname = 'pma_hostname';
$tablename = 'pma_tablename';
$password = 'pma_password';
$_REQUEST['adduser_submit'] = true;
$_POST['pred_username'] = 'any';
$_POST['pred_hostname'] = 'localhost';
$_REQUEST['createdb-3'] = true;
$_POST['Grant_priv'] = 'Y';
$_POST['max_questions'] = 1000;
list($sql_query, $message) = PMA_updatePrivileges(
$username, $hostname, $tablename, $dbname
);
$this->assertEquals(
"You have updated the privileges for 'pma_username'@'pma_hostname'.",
$message->getMessage()
);
$this->assertEquals(
"REVOKE ALL PRIVILEGES ON `pma_dbname`.`pma_tablename` "
. "FROM 'pma_username'@'pma_hostname'; ",
$sql_query
);
}
/**
* Test for PMA_getHtmlForSubMenusOnUsersPage
*
@ -208,19 +487,13 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
//validate 5: $sql_query
$this->assertEquals(
"GRANT USAGE ON *.* TO 'PMA_username'@'PMA_hostname';"
. "CREATE DATABASE IF NOT EXISTS `PMA_username`;"
. "GRANT ALL PRIVILEGES ON `PMA\_username`.* TO "
. "'PMA_username'@'PMA_hostname';"
. "GRANT ALL PRIVILEGES ON `PMA_username\_%`.* TO "
. "'PMA_username'@'PMA_hostname';"
. "GRANT ALL PRIVILEGES ON `PMA_db`.* TO 'PMA_username'@'PMA_hostname';",
"GRANT USAGE ON *.* TO 'PMA_username'@'PMA_hostname';",
$sql_query
);
//validate 6: $message
$this->assertEquals(
"",
"You have added a new user.",
$message->getMessage()
);
}