Merge pull request #580 from adamgsoc2013/ut_plu_dbi

fix code Static Analysis Warnings
This commit is contained in:
Michal Čihař 2013-08-09 09:33:47 -07:00
commit 5649872c03
25 changed files with 238 additions and 11 deletions

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_Database_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,11 @@ class Node_Database_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_Database');

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_Event_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,11 @@ class Node_Event_Container_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_Event_Container');

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_Event_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,11 @@ class Node_Event_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_Event');

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_Function_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,11 @@ class Node_Function_Container_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_Function_Container');

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_Function_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,11 @@ class Node_Function_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_Function');

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_Index_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,11 @@ class Node_Index_Container_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_Index_Container');

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_Index_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,11 @@ class Node_Index_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_Index');

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_Procedure_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,11 @@ class Node_Procedure_Container_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_Procedure_Container');

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_Procedure_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,11 @@ class Node_Procedure_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_Procedure');

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_Table_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,12 @@ class Node_Table_Container_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_Table_Container');

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_Table_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,12 @@ class Node_Table_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_Table');

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_Trigger_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,12 @@ class Node_Trigger_Container_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_Trigger_Container');

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_Trigger_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,12 @@ class Node_Trigger_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_Trigger');

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_View_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,12 @@ class Node_View_Container_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_View_Container');

View File

@ -17,6 +17,11 @@ require_once 'libraries/Theme.class.php';
*/
class Node_View_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -24,6 +29,12 @@ class Node_View_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* Test for __construct
*
* @return void
*/
public function testConstructor()
{
$parent = PMA_NodeFactory::getInstance('Node_View');

View File

@ -18,6 +18,11 @@ require_once 'libraries/database_interface.inc.php';
*/
class Node_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['server'] = 0;
@ -25,6 +30,11 @@ class Node_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
}
/**
* SetUp for AddNode
*
* @return void
*/
public function testAddNode()
{
$parent = PMA_NodeFactory::getInstance('Node', 'parent');
@ -40,6 +50,11 @@ class Node_Test extends PHPUnit_Framework_TestCase
);
}
/**
* SetUp for getChild
*
* @return void
*/
public function testGetChildError()
{
$parent = PMA_NodeFactory::getInstance('Node', 'parent');
@ -53,6 +68,11 @@ class Node_Test extends PHPUnit_Framework_TestCase
);
}
/**
* SetUp for getChild
*
* @return void
*/
public function testRemoveNode()
{
$parent = PMA_NodeFactory::getInstance('Node', 'parent');
@ -69,6 +89,11 @@ class Node_Test extends PHPUnit_Framework_TestCase
);
}
/**
* SetUp for hasChildren
*
* @return void
*/
public function testNodeHasChildren()
{
$parent = PMA_NodeFactory::getInstance();
@ -107,6 +132,11 @@ class Node_Test extends PHPUnit_Framework_TestCase
);
}
/**
* SetUp for numChildren
*
* @return void
*/
public function testNumChildren()
{
// start with root node only
@ -134,6 +164,11 @@ class Node_Test extends PHPUnit_Framework_TestCase
$this->assertEquals($parent->numChildren(), 3);
}
/**
* SetUp for parents
*
* @return void
*/
public function testParents()
{
$parent = PMA_NodeFactory::getInstance();
@ -150,6 +185,11 @@ class Node_Test extends PHPUnit_Framework_TestCase
); // include self
}
/**
* SetUp for realParent
*
* @return void
*/
public function testRealParent()
{
$parent = PMA_NodeFactory::getInstance();
@ -403,6 +443,11 @@ class Node_Test extends PHPUnit_Framework_TestCase
$node->getPresence('', 'dbname');
}
/**
* SetUp for getComment
*
* @return void
*/
public function testComment()
{
// A non-qualified Node shouldn't have a comment

View File

@ -124,7 +124,8 @@ class Image_PNG_Inline_Test extends PHPUnit_Framework_TestCase
$buffer = "PMA_PNG_Inline";
$options = array("./image/", "200", "wrapper_link"=>"PMA_wrapper_link");
$result = '<a href="transformation_wrapper.phpPMA_wrapper_link"'
. ' target="_blank"><img src="transformation_wrapper.phpPMA_wrapper_link&amp;'
. ' target="_blank"><img src="transformation_wrapper.php'
. 'PMA_wrapper_link&amp;'
. 'resize=jpeg&amp;newWidth=./image/&amp;newHeight=200" '
. 'alt="PMA_PNG_Inline" border="0" /></a>';
$this->assertEquals(

View File

@ -58,7 +58,8 @@ class Text_Plain_Append_Test extends PHPUnit_Framework_TestCase
*/
public function testGetInfo()
{
$info = 'Appends text to a string. The only option is the text to be appended'
$info = 'Appends text to a string. The only option is '
. 'the text to be appended'
. ' (enclosed in single quotes, default empty string).';
$this->assertEquals(
$info,

View File

@ -165,7 +165,8 @@ class Text_Plain_Dateformat_Test extends PHPUnit_Framework_TestCase
//string
$timestamp = "20100201";
$result = '<dfn onclick="alert(\'20100201\');" title="20100201">Feb 01, 2010 at 12:00 AM</dfn>';
$result = '<dfn onclick="alert(\'20100201\');" title="20100201">'
. 'Feb 01, 2010 at 12:00 AM</dfn>';
$this->assertEquals(
$result,
$this->object->applyTransformation($timestamp, $options, $meta)
@ -175,6 +176,11 @@ class Text_Plain_Dateformat_Test extends PHPUnit_Framework_TestCase
}
}
/**
* Mock Class Text_Plain_Dateformat_Meta
*
* @package PhpMyAdmin-test
*/
class Text_Plain_Dateformat_Meta
{
var $blob = null;

View File

@ -155,17 +155,30 @@ class Text_Plain_External_Test extends PHPUnit_Framework_TestCase
true,
$this->object->applyTransformationNoWrap($options)
);
$options = array("/dev/null -i -wrap -q", "/dev/null -i -wrap -q", "/dev/null -i -wrap -q", 1);
$options = array(
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q", 1
);
$this->assertEquals(
true,
$this->object->applyTransformationNoWrap($options)
);
$options = array("/dev/null -i -wrap -q", "/dev/null -i -wrap -q", "/dev/null -i -wrap -q", "1");
$options = array(
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q", "1"
);
$this->assertEquals(
true,
$this->object->applyTransformationNoWrap($options)
);
$options = array("/dev/null -i -wrap -q", "/dev/null -i -wrap -q", "/dev/null -i -wrap -q", 2);
$options = array(
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
"/dev/null -i -wrap -q",
2
);
$this->assertEquals(
false,
$this->object->applyTransformationNoWrap($options)

View File

@ -60,7 +60,8 @@ class Text_Plain_Imagelink_Test extends PHPUnit_Framework_TestCase
{
$info = 'Displays an image and a link; '
. 'the column contains the filename. The first option'
. ' is a URL prefix like "http://www.example.com/". The second and third options'
. ' is a URL prefix like "http://www.example.com/". '
. 'The second and third options'
. ' are the width and the height in pixels.';
$this->assertEquals(
$info,

View File

@ -98,7 +98,8 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`query` text COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Bookmarks'";
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
. "COLLATE=utf8_bin COMMENT='Bookmarks'";
$dbi->expects($this->once())
->method('fetchValue')

View File

@ -99,7 +99,8 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`query` text COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Bookmarks'";
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
. "COLLATE=utf8_bin COMMENT='Bookmarks'";
$dbi->expects($this->once())
->method('fetchValue')

View File

@ -139,7 +139,8 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`query` text COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Bookmarks'";
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
. "COLLATE=utf8_bin COMMENT='Bookmarks'";
$dbi->expects($this->once())
->method('fetchValue')

View File

@ -100,7 +100,8 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`query` text COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Bookmarks'";
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
. "COLLATE=utf8_bin COMMENT='Bookmarks'";
$dbi->expects($this->once())
->method('fetchValue')