Merge pull request #494 from ayushchd/unit_testing
UTs: fixes and improvements
This commit is contained in:
commit
20a0cbba62
@ -175,6 +175,10 @@ function PMA_readUserprefsFieldNames(array $forms = null)
|
||||
{
|
||||
static $names;
|
||||
|
||||
if (defined('TESTSUITE')) {
|
||||
$names = null;
|
||||
}
|
||||
|
||||
// return cached results
|
||||
if ($names !== null) {
|
||||
return $names;
|
||||
|
||||
@ -39,6 +39,7 @@ class PMA_ConfigGenerator_Test extends PHPUnit_Framework_TestCase
|
||||
|
||||
$GLOBALS['server'] = 0;
|
||||
$cf = ConfigFile::getInstance();
|
||||
$_SESSION['ConfigFile0'] = array('a', 'b', 'c');
|
||||
$_SESSION['ConfigFile0']['Servers'] = array(
|
||||
array(1, 2, 3)
|
||||
);
|
||||
|
||||
@ -233,6 +233,7 @@ class PMA_FormDisplay_Tpl_Test extends PHPUnit_Framework_TestCase
|
||||
$opts['doc'] = "http://doclink";
|
||||
$opts['wiki'] = "http://wikilink";
|
||||
$opts['comment'] = "testComment";
|
||||
$opts['comment_warning'] = true;
|
||||
$opts['show_restore_default'] = true;
|
||||
ob_start();
|
||||
PMA_displayInput(
|
||||
@ -319,7 +320,7 @@ class PMA_FormDisplay_Tpl_Test extends PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertTag(
|
||||
$this->_getTagArray(
|
||||
'<span class="field-comment-mark" title="testComment">',
|
||||
'<span class="field-comment-mark field-comment-warning" title="testComment">',
|
||||
array('content' => 'i')
|
||||
),
|
||||
$result
|
||||
|
||||
@ -293,16 +293,26 @@ class PMA_User_Preferences_Test extends PHPUnit_Framework_TestCase
|
||||
|
||||
/**
|
||||
* Test for PMA_readUserprefsFieldNames
|
||||
* This test would only work when executed with other tests.
|
||||
* This is to test "static" nature of this function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testReadUserprefsFieldNames()
|
||||
{
|
||||
$this->assertCount(
|
||||
216,
|
||||
PMA_readUserprefsFieldNames()
|
||||
);
|
||||
|
||||
$forms = array(
|
||||
'form1' => array(
|
||||
array('Servers/1/hide_db', 'bar'),
|
||||
array('test' => 'val')
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
array('Servers/1/hide_db', 'bar', 'test'),
|
||||
PMA_readUserprefsFieldNames(array())
|
||||
PMA_readUserprefsFieldNames($forms)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user