Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix code comments on test codes #568

Merged
merged 4 commits into from

2 participants

adamgsoc2013 Michal Čihař
This page is out of date. Refresh to see the latest.
12 test/classes/dbi/DBIDrizzle_test.php
View
@@ -8,11 +8,23 @@
/*
* Include to test and mock Drizzle class.
*/
+/**
+ * Drizzle for Mock drizzle class
+ *
+ * this class is for Mock Drizzle
+ *
+ * @package PhpMyAdmin-test
+ */
class Drizzle
{
}
+/**
+ * function to return drizzle_version
+ *
+ * @return string
+ */
function drizzle_version()
{
return "1.0.0";
12 test/libraries/PMA_SQL_parse_analyze_test.php
View
@@ -12,8 +12,20 @@
require_once 'libraries/Util.class.php';
require_once 'libraries/sqlparser.lib.php';
+/**
+ * PMA_SQLParserAnalyze_Test class
+ *
+ * this class is for testing sqlparser.lib.php
+ *
+ * @package PhpMyAdmin-test
+ */
class PMA_SQLParserAnalyze_Test extends PHPUnit_Framework_TestCase
{
+ /**
+ * Test for PMA_SQP_getParserAnalyze
+ *
+ * @return void
+ */
public function testPMA_SQP_getParserAnalyzeMa()
{
//select statement
57 test/libraries/PMA_SQL_parser_data_test.php
View
@@ -12,8 +12,22 @@
require_once 'libraries/sqlparser.data.php';
require_once 'libraries/sqlparser.lib.php';
+/**
+ * PMA_SQLParser_Data_Test class
+ *
+ * this class is for testing sqlparser.data.php
+ *
+ * @package PhpMyAdmin-test
+ */
class PMA_SQLParser_Data_Test extends PHPUnit_Framework_TestCase
{
+ /**
+ * assert Sorted values
+ *
+ * @param array $array Sorted values array
+ *
+ * @return null
+ */
private function _assertSorted($array)
{
$copy = $array;
@@ -22,11 +36,24 @@ private function _assertSorted($array)
$this->assertEquals($difference, array());
}
+ /**
+ * assert Parser values
+ *
+ * @param string $name Parser Data key
+ *
+ * @return null
+ */
private function _assertParserData($name)
{
$this->_assertSorted($GLOBALS[$name]);
}
+
+ /**
+ * Test for PMA_SQPdata
+ *
+ * @return void
+ */
public function testPMA_SQPdata()
{
$data = PMA_SQP_getParserDataMap();
@@ -37,26 +64,56 @@ public function testPMA_SQPdata()
$this->_assertSorted($data['PMA_SQPdata_column_type']);
}
+
+ /**
+ * Test for PMA_SQPdata_function_name
+ *
+ * @return void
+ */
public function testPMA_SQPdata_function_name()
{
$this->_assertParserData('PMA_SQPdata_function_name');
}
+
+ /**
+ * Test for PMA_SQPdata_column_attrib
+ *
+ * @return void
+ */
public function testPMA_SQPdata_column_attrib()
{
$this->_assertParserData('PMA_SQPdata_column_attrib');
}
+
+ /**
+ * Test for PMA_SQPdata_reserved_word
+ *
+ * @return void
+ */
public function testPMA_SQPdata_reserved_word()
{
$this->_assertParserData('PMA_SQPdata_reserved_word');
}
+
+ /**
+ * Test for PMA_SQPdata_forbidden_word
+ *
+ * @return void
+ */
public function testPMA_SQPdata_forbidden_word()
{
$this->_assertParserData('PMA_SQPdata_forbidden_word');
}
+
+ /**
+ * Test for PMA_SQPdata_column_type
+ *
+ * @return void
+ */
public function testPMA_SQPdata_column_type()
{
$this->_assertParserData('PMA_SQPdata_column_type');
14 test/libraries/PMA_SQL_parser_test.php
View
@@ -17,6 +17,13 @@
require_once 'libraries/Theme.class.php';
require_once 'libraries/sanitizing.lib.php';
+/**
+ * PMA_SQLParser_Test class
+ *
+ * this class is for testing sqlparser.lib.php
+ *
+ * @package PhpMyAdmin-test
+ */
class PMA_SQLParser_Test extends PHPUnit_Framework_TestCase
{
/**
@@ -53,7 +60,12 @@ public function testParser($sql, $expected, $error = '')
$this->assertEquals('', PMA_SQP_getErrorString());
$this->assertEquals($expected, $parsed_sql);
}
-
+
+ /**
+ * Test for PMA_SQP_isKeyWord
+ *
+ * @return void
+ */
public function testPMA_SQP_isKeyWord()
{
PMA_SQP_resetError();
14 test/libraries/PMA_ip_allow_deny_test.php
View
@@ -15,8 +15,20 @@
require_once 'libraries/Tracker.class.php';
require_once 'libraries/ip_allow_deny.lib.php';
-class PMA_Ip_allow_deny_Test extends PHPUnit_Framework_TestCase
+/**
+ * PMA_Ip_Allow_Deny_Test class
+ *
+ * this class is for testing ip_allow_deny.lib.php
+ *
+ * @package PhpMyAdmin-test
+ */
+class PMA_Ip_Allow_Deny_Test extends PHPUnit_Framework_TestCase
{
+ /**
+ * Prepares environment for the test.
+ *
+ * @return void
+ */
public function setUp()
{
$GLOBALS['cfg']['Server']['user'] = "pma_username";
75 test/libraries/PMA_relation_cleanup_test.php
View
@@ -17,9 +17,20 @@
require_once 'libraries/relation.lib.php';
require_once 'libraries/relation_cleanup.lib.php';
-
+/**
+ * PMA_Relation_Cleanup_Test class
+ *
+ * this class is for testing relation_cleanup.lib.php functions
+ *
+ * @package PhpMyAdmin-test
+ */
class PMA_Relation_Cleanup_Test extends PHPUnit_Framework_TestCase
{
+ /**
+ * Prepares environment for the test.
+ *
+ * @return void
+ */
public function setUp()
{
$_SESSION['relation'] = array();
@@ -45,6 +56,12 @@ public function setUp()
$this->redefineRelation();
}
+
+ /**
+ * functions for redefine DBI_PMA_Relation_Cleanup
+ *
+ * @return void
+ */
public function redefineRelation()
{
$GLOBALS['dbi'] = new DBI_PMA_Relation_Cleanup();
@@ -281,13 +298,24 @@ public function testPMA_relationsCleanupDatabase()
}
}
-//Mock DBI
+/**
+ * DBI_PMA_Relation_Cleanup for Mock DBI class
+ *
+ * this class is for Mock DBI
+ *
+ * @package PhpMyAdmin-test
+ */
class DBI_PMA_Relation_Cleanup extends PMA_DatabaseInterface
{
var $index;
var $values = array();
var $indexs = array();
+
+ /**
+ * Constructor
+ *
+ */
public function __construct()
{
$this->index = 0;
@@ -327,6 +355,13 @@ public function __construct()
);
}
+ /**
+ * returns array of rows with numeric keys from $result
+ *
+ * @param object $result result set identifier
+ *
+ * @return array
+ */
function fetchRow($result)
{
if ($this->index < count($this->values)) {
@@ -339,6 +374,17 @@ function fetchRow($result)
return false;
}
+
+ /**
+ * runs a query
+ *
+ * @param string $sql SQL query to execte
+ * @param mixed $link optional database link to use
+ * @param int $options optional query options
+ * @param bool $cache_affected_rows whether to cache affected rows
+ *
+ * @return mixed
+ */
function query($sql, $link = null, $options = 0, $cache_affected_rows = true)
{
if (stripos($sql, "column_info") !== false) {
@@ -370,17 +416,42 @@ function query($sql, $link = null, $options = 0, $cache_affected_rows = true)
}
}
+ /**
+ * runs a query and returns the result
+ *
+ * @param string $query query to run
+ * @param resource $link mysql link resource
+ * @param integer $options query options
+ * @param bool $cache_affected_rows whether to cache affected row
+ *
+ * @return mixed
+ */
public function tryQuery(
$query, $link = null, $options = 0, $cache_affected_rows = true
) {
return true;
}
+ /**
+ * selects given database
+ *
+ * @param string $dbname database name to select
+ * @param object $link connection object
+ *
+ * @return boolean
+ */
public function selectDb($dbname, $link = null)
{
return true;
}
+ /**
+ * Frees memory associated with the result
+ *
+ * @param object $result database result
+ *
+ * @return void
+ */
public function freeResult($result)
{
return true;
Something went wrong with that request. Please try again.