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

This commit is contained in:
xmujay 2013-07-07 10:25:53 +08:00
commit 864be4d665
8 changed files with 208 additions and 52 deletions

View File

@ -46,6 +46,11 @@ $GLOBALS['dummy_queries'] = array(
'Support' => 'NO',
'Comment' => 'dummy2 comment'
),
array(
'Engine' => 'FEDERATED',
'Support' => 'NO',
'Comment' => 'Federated MySQL storage engine'
),
)
),
array(

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-07-04 06:07-0400\n"
"PO-Revision-Date: 2013-07-05 16:32+0200\n"
"PO-Revision-Date: 2013-07-05 16:35+0200\n"
"Last-Translator: Tony Chen <tonychen@finenet.com.tw>\n"
"Language-Team: Traditional Chinese "
"<http://l10n.cihar.com/projects/phpmyadmin/master/zh_TW/>\n"
@ -1693,7 +1693,7 @@ msgstr "隱藏搜尋條件"
#: js/messages.php:279
#| msgid "Show search criteria"
msgid "Show find and replace criteria"
msgstr "顯示尋找並取代條件"
msgstr "顯示尋找並替換條件"
#: js/messages.php:282 libraries/TableSearch.class.php:210
msgid "Zoom Search"
@ -3244,7 +3244,7 @@ msgstr "替換爲"
#: libraries/TableSearch.class.php:1333
msgid "Find and replace - preview"
msgstr "預覽 - 尋找和替換"
msgstr "尋找和替換-預覽"
#: libraries/TableSearch.class.php:1337
#, fuzzy
@ -3260,12 +3260,12 @@ msgstr "原有字串"
#: libraries/TableSearch.class.php:1339
#| msgid "Related Links"
msgid "Replaced string"
msgstr "取代字串"
msgstr "替換字串"
#: libraries/TableSearch.class.php:1364
#| msgid "Replicated"
msgid "Replace"
msgstr "取代"
msgstr "替換"
#: libraries/Theme.class.php:170
#, php-format

View File

@ -73,6 +73,11 @@ class PMA_StorageEngineTest extends PHPUnit_Framework_TestCase
'Support' => 'NO',
'Comment' => 'dummy2 comment',
),
'FEDERATED' => array(
'Engine' => 'FEDERATED',
'Support' => 'NO',
'Comment' => 'Federated MySQL storage engine'
),
),
$this->object->getStorageEngines()
);
@ -87,15 +92,11 @@ class PMA_StorageEngineTest extends PHPUnit_Framework_TestCase
*/
public function testGetHtmlSelect()
{
$html = $this->object->getHtmlSelect();
$this->assertEquals(
'<select name="engine">
<option value="dummy" title="dummy comment">
dummy
</option>
</select>
',
$this->object->getHtmlSelect()
$this->assertContains(
'<option value="dummy" title="dummy comment">',
$html
);
}

View File

@ -58,7 +58,7 @@ class PMA_ServerBinlog_Test extends PHPUnit_Framework_TestCase
*
* @return void
*/
public function testPMA_getLogSelector()
public function testPMAGetLogSelector()
{
$binary_log_file_names = array();
$binary_log_file_names[] = array("Log_name"=>"index1", "File_size"=>100);
@ -88,7 +88,7 @@ class PMA_ServerBinlog_Test extends PHPUnit_Framework_TestCase
*
* @return void
*/
public function testPMA_getLogInfo()
public function testPMAGetLogInfo()
{
$binary_log_file_names = array();
$binary_log_file_names[] = array("Log_name"=>"index1", "File_size"=>100);
@ -121,27 +121,27 @@ class PMA_ServerBinlog_Test extends PHPUnit_Framework_TestCase
)
);
$value = array(
'Info' => "index1_Info",
'Log_name' => "index1_Log_name",
'Pos' => "index1_Pos",
'Event_type' => "index1_Event_type",
'End_log_pos' => "index1_End_log_pos",
'Server_id' => "index1_Server_id",
'Info' => "index1_Info",
'Log_name' => "index1_Log_name",
'Pos' => "index1_Pos",
'Event_type' => "index1_Event_type",
'End_log_pos' => "index1_End_log_pos",
'Server_id' => "index1_Server_id",
);
$count = 3;
//expects functions
$dbi->expects($this->once())->method('query')
->will($this->returnValue($result));
->will($this->returnValue($result));
$dbi->expects($this->once())->method('numRows')
->will($this->returnValue($count));
->will($this->returnValue($count));
$dbi->expects($this->at(0))->method('fetchAssoc')
->will($this->returnValue($value));
->will($this->returnValue($value));
$dbi->expects($this->at(1))->method('fetchAssoc')
->will($this->returnValue(false));
->will($this->returnValue(false));
$GLOBALS['dbi'] = $dbi;
@ -164,8 +164,10 @@ class PMA_ServerBinlog_Test extends PHPUnit_Framework_TestCase
$html
);
//validate 4: PMA_getNavigationRow is right
$urlNavigation = 'server_binlog.php?log=log&amp;dontlimitchars=1&amp;'
. 'pos=3&amp;server=1&amp';
$this->assertContains(
'server_binlog.php?log=log&amp;dontlimitchars=1&amp;pos=3&amp;server=1&amp',
$urlNavigation,
$html
);
$this->assertContains(

View File

@ -17,8 +17,8 @@ $GLOBALS['url_query'] = "url_query";
$GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
$GLOBALS['lang'] = "en";
$GLOBALS['available_languages']= array(
"en" => array("English", "US-ENGLISH"),
"ch" => array("Chinese", "TW-Chinese")
"en" => array("English", "US-ENGLISH"),
"ch" => array("Chinese", "TW-Chinese")
);
$GLOBALS['text_dir'] = "text_dir";
$GLOBALS['cfg']['DBG']['sql'] = false;
@ -73,32 +73,32 @@ class PMA_ServerCollations_Test extends PHPUnit_Framework_TestCase
*
* @return void
*/
public function testPMA_getHtmlForCharsets()
public function testPMAGetHtmlForCharsets()
{
$mysql_charsets = array("armscii8", "ascii", "big5", "binary");
$mysql_collations = array(
"armscii8" => array("armscii8"),
"armscii8" => array("armscii8"),
"ascii" => array("ascii"),
"big5" => array("big5"),
"binary" => array("binary"),
"binary" => array("binary"),
);
$mysql_charsets_descriptions = array(
"armscii8" => "PMA_armscii8_general_ci",
"armscii8" => "PMA_armscii8_general_ci",
"ascii" => "PMA_ascii_general_ci",
"big5" => "PMA_big5_general_ci",
"binary" => "PMA_binary_general_ci",
"binary" => "PMA_binary_general_ci",
);
$mysql_default_collations = array(
"armscii8" => "armscii8",
"armscii8" => "armscii8",
"ascii" => "ascii",
"big5" => "big5",
"binary" => "binary",
"binary" => "binary",
);
$mysql_collations_available = array(
"armscii8" => true,
"armscii8" => true,
"ascii" => true,
"big5" => true,
"binary" => true,
"binary" => true,
);
//Mock DBI

View File

@ -32,39 +32,41 @@ class PMA_ServerCommon_Test extends PHPUnit_Framework_TestCase
*
* @return void
*/
public function testPMA_getSubPageHeader()
public function testPMAGetSubPageHeader()
{
//server_engines
$html = PMA_getSubPageHeader("engines");
//server_engines
$html = PMA_getSubPageHeader("engines");
$this->assertContains(
'<img src="themes/dot.gif" title="" alt="" class="icon ic_b_engine" />',
$html
$html
);
$this->assertContains(
'Storage Engines',
$html
$html
);
//server_databases
$html = PMA_getSubPageHeader("databases");
//server_databases
$html = PMA_getSubPageHeader("databases");
$this->assertContains(
'<img src="themes/dot.gif" title="" alt="" class="icon ic_s_db" />',
$html
$html
);
$this->assertContains(
'Databases',
$html
$html
);
//server_replication
$html = PMA_getSubPageHeader("replication");
//server_replication
$html = PMA_getSubPageHeader("replication");
$replication_img = '<img src="themes/dot.gif" title="" '
. 'alt="" class="icon ic_s_replication" />';
$this->assertContains(
'<img src="themes/dot.gif" title="" alt="" class="icon ic_s_replication" />',
$html
$replication_img,
$html
);
$this->assertContains(
'Replication',
$html
$html
);
}

View File

@ -0,0 +1,146 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for server_engines.lib.php
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/Util.class.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/server_engines.lib.php';
require_once 'libraries/Theme.class.php';
require_once 'libraries/Tracker.class.php';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/Message.class.php';
require_once 'libraries/sanitizing.lib.php';
require_once 'libraries/sqlparser.lib.php';
require_once 'libraries/js_escape.lib.php';
require_once 'libraries/StorageEngine.class.php';
class PMA_ServerEngines_Test extends PHPUnit_Framework_TestCase
{
/**
* Prepares environment for the test.
*
* @return void
*/
public function setUp()
{
//$_REQUEST
$_REQUEST['log'] = "index1";
$_REQUEST['pos'] = 3;
//$GLOBALS
$GLOBALS['cfg']['MaxRows'] = 10;
$GLOBALS['cfg']['ServerDefault'] = "server";
$GLOBALS['cfg']['RememberSorting'] = true;
$GLOBALS['cfg']['SQP'] = array();
$GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 1000;
$GLOBALS['cfg']['ShowSQL'] = true;
$GLOBALS['cfg']['SQP']['fmtType'] = 'none';
$GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
$GLOBALS['cfg']['LimitChars'] = 100;
$GLOBALS['cfg']['DBG']['sql'] = false;
$GLOBALS['cfg']['MySQLManualType'] = 'viewable';
$GLOBALS['table'] = "table";
$GLOBALS['pmaThemeImage'] = 'image';
//$_SESSION
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
$_SESSION['PMA_Theme'] = new PMA_Theme();
}
/**
* Test for PMA_getHtmlForServerEngines for all engines
*
* @return void
*/
public function testPMAGetPluginAndModuleInfo()
{
//test PMA_getHtmlForAllServerEngines
$html = PMA_getHtmlForServerEngines();
//validate 1: Item header
$this->assertContains(
'<th>Storage Engine</th>',
$html
);
$this->assertContains(
'<th>Description</th>',
$html
);
//validate 2: FEDERATED
$this->assertContains(
'<td>Federated MySQL storage engine</td>',
$html
);
$this->assertContains(
'FEDERATED',
$html
);
$this->assertContains(
'server_engines.php?engine=FEDERATED',
$html
);
//validate 3: dummy
$this->assertContains(
'<td>dummy comment</td>',
$html
);
$this->assertContains(
'dummy',
$html
);
$this->assertContains(
'server_engines.php?engine=dummy',
$html
);
}
/**
* Test for PMA_getHtmlForServerEngines for specific engines "FEDERATED"
*
* @return void
*/
public function testPMAGetPluginAndModuleInfoSpecific()
{
$_REQUEST['engine'] = "FEDERATED";
//Mock DBI
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
//test PMA_getHtmlForAllServerEngines for specific engines "FEDERATED"
$html = PMA_getHtmlForServerEngines();
//validate 1: Engine header
$this->assertContains(
'FEDERATED',
$html
);
$this->assertContains(
'Federated MySQL storage engine',
$html
);
$this->assertContains(
'This MySQL server does not support the FEDERATED storage engine.',
$html
);
$enginer_info = 'There is no detailed status information '
. 'available for this storage engine';
$this->assertContains(
$enginer_info,
$html
);
}
}

View File

@ -58,7 +58,7 @@ class PMA_ServerPlugins_Test extends PHPUnit_Framework_TestCase
*
* @return void
*/
public function testPMA_getPluginAndModuleInfo()
public function testPMAGetPluginAndModuleInfo()
{
//Mock DBI
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')