Merge pull request #325 from adamgsoc2013/unit_nodeG
add more case for other PMA_Node class
This commit is contained in:
commit
02e7c378f5
51
test/classes/navigation/PMA_Node_Table_test.php
Normal file
51
test/classes/navigation/PMA_Node_Table_test.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* tests for NodeFactory class and Node_Column class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
require_once 'libraries/navigation/NodeFactory.class.php';
|
||||
require_once 'libraries/Util.class.php';
|
||||
require_once 'libraries/Theme.class.php';
|
||||
|
||||
|
||||
class Node_Table_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setup()
|
||||
{
|
||||
$GLOBALS['server'] = 0;
|
||||
$GLOBALS['token'] = 'token';
|
||||
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
|
||||
}
|
||||
|
||||
public function testConstructor()
|
||||
{
|
||||
$parent = PMA_NodeFactory::getInstance('Node_Table');
|
||||
$this->assertArrayHasKey(
|
||||
'text',
|
||||
$parent->links
|
||||
);
|
||||
$this->assertContains(
|
||||
'sql.php',
|
||||
$parent->links['text']
|
||||
);
|
||||
}
|
||||
|
||||
public function testAddNode()
|
||||
{
|
||||
$parent = PMA_NodeFactory::getInstance('Node_Table', 'parent');
|
||||
$child = PMA_NodeFactory::getInstance('Node_Table', 'child');
|
||||
$parent->addChild($child);
|
||||
$this->assertEquals(
|
||||
$parent->getChild($child->name),
|
||||
$child
|
||||
);
|
||||
$this->assertEquals(
|
||||
$parent->getChild($child->real_name, true),
|
||||
$child
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
51
test/classes/navigation/PMA_Node_Trigger_test.php
Normal file
51
test/classes/navigation/PMA_Node_Trigger_test.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* tests for NodeFactory class and Node_Column class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
require_once 'libraries/navigation/NodeFactory.class.php';
|
||||
require_once 'libraries/Util.class.php';
|
||||
require_once 'libraries/Theme.class.php';
|
||||
|
||||
|
||||
class Node_Trigger_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setup()
|
||||
{
|
||||
$GLOBALS['server'] = 0;
|
||||
$GLOBALS['token'] = 'token';
|
||||
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
|
||||
}
|
||||
|
||||
public function testConstructor()
|
||||
{
|
||||
$parent = PMA_NodeFactory::getInstance('Node_Trigger');
|
||||
$this->assertArrayHasKey(
|
||||
'text',
|
||||
$parent->links
|
||||
);
|
||||
$this->assertContains(
|
||||
'db_triggers.php',
|
||||
$parent->links['text']
|
||||
);
|
||||
}
|
||||
|
||||
public function testAddNode()
|
||||
{
|
||||
$parent = PMA_NodeFactory::getInstance('Node_Trigger', 'parent');
|
||||
$child = PMA_NodeFactory::getInstance('Node_Trigger', 'child');
|
||||
$parent->addChild($child);
|
||||
$this->assertEquals(
|
||||
$parent->getChild($child->name),
|
||||
$child
|
||||
);
|
||||
$this->assertEquals(
|
||||
$parent->getChild($child->real_name, true),
|
||||
$child
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
51
test/classes/navigation/PMA_Node_View_test.php
Normal file
51
test/classes/navigation/PMA_Node_View_test.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* tests for NodeFactory class and Node_Column class
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
require_once 'libraries/navigation/NodeFactory.class.php';
|
||||
require_once 'libraries/Util.class.php';
|
||||
require_once 'libraries/Theme.class.php';
|
||||
|
||||
|
||||
class Node_View_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setup()
|
||||
{
|
||||
$GLOBALS['server'] = 0;
|
||||
$GLOBALS['token'] = 'token';
|
||||
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
|
||||
}
|
||||
|
||||
public function testConstructor()
|
||||
{
|
||||
$parent = PMA_NodeFactory::getInstance('Node_View');
|
||||
$this->assertArrayHasKey(
|
||||
'text',
|
||||
$parent->links
|
||||
);
|
||||
$this->assertContains(
|
||||
'sql.php',
|
||||
$parent->links['text']
|
||||
);
|
||||
}
|
||||
|
||||
public function testAddNode()
|
||||
{
|
||||
$parent = PMA_NodeFactory::getInstance('Node_View', 'parent');
|
||||
$child = PMA_NodeFactory::getInstance('Node_View', 'child');
|
||||
$parent->addChild($child);
|
||||
$this->assertEquals(
|
||||
$parent->getChild($child->name),
|
||||
$child
|
||||
);
|
||||
$this->assertEquals(
|
||||
$parent->getChild($child->real_name, true),
|
||||
$child
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user