Tests for changing icon based on link target

This commit is contained in:
Kasun Chathuranga 2013-09-04 07:07:05 +05:30
parent 169aa233e4
commit 7c96afbf1a
2 changed files with 35 additions and 2 deletions

View File

@ -19,7 +19,7 @@ class Node_Table_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -47,5 +47,37 @@ class Node_Table_Test extends PHPUnit_Framework_TestCase
$parent->links['text']
);
}
/**
* Tests whether the node icon is properly set based on the icon target.
*
* @param string $target target of the icon
* @param string $imageName name of the image that should be set
*
* @return void
* @dataProvider providerForTestIcon
*/
public function testIcon($target, $imageName)
{
$GLOBALS['cfg']['NavigationTreeDefaultTabTable'] = $target;
$node = PMA_NodeFactory::getInstance('Node_Table');
$this->assertContains($imageName, $node->icon);
}
/**
* Data provider for testIcon().
*
* @return array data for testIcon()
*/
public function providerForTestIcon()
{
return array(
array('tbl_structure.php', 'b_props'),
array('tbl_select.php', 'b_search'),
array('tbl_change.php', 'b_insrow'),
array('tbl_sql.php', 'b_sql'),
array('sql.php', 'b_browse'),
);
}
}
?>

View File

@ -19,7 +19,7 @@ class Node_View_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -46,6 +46,7 @@ class Node_View_Test extends PHPUnit_Framework_TestCase
'sql.php',
$parent->links['text']
);
$this->assertContains('b_props', $node->icon);
}
}
?>