Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Ungureanu <udan1107@gmail.com>2015-06-30 22:14:58 +0300
committerDan Ungureanu <udan1107@gmail.com>2015-07-10 23:18:16 +0300
commit2826b6b328dea467bb8a368d3a5fa96523ef173f (patch)
tree9bd0f1d5b91c57963a4e1ef48accf7741861aa06 /test
parent825cfbdc11436e9c125b680aa1df98868dd657a7 (diff)
More refactoring.
Signed-off-by: Dan Ungureanu <udan1107@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/classes/PMA_DisplayResults_test.php84
-rw-r--r--test/classes/PMA_Util_test.php36
2 files changed, 20 insertions, 100 deletions
diff --git a/test/classes/PMA_DisplayResults_test.php b/test/classes/PMA_DisplayResults_test.php
index 9846c986dd..9c69a6b004 100644
--- a/test/classes/PMA_DisplayResults_test.php
+++ b/test/classes/PMA_DisplayResults_test.php
@@ -94,15 +94,18 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
*/
public function testisSelect()
{
- $analyzed_sql = array(array());
- $analyzed_sql[0]['select_expr'] = array();
- $analyzed_sql[0]['queryflags']['select_from'] = 'pma';
- $analyzed_sql[0]['table_ref'] = array('table_ref');
-
+ $parser = new \SqlParser\Parser('SELECT * FROM pma');
$this->assertTrue(
$this->_callPrivateFunction(
'_isSelect',
- array($analyzed_sql)
+ array(
+ array(
+ 'statement' => $parser->statements[0],
+ 'queryflags' => array(
+ 'select_from' => true,
+ ),
+ ),
+ )
)
);
}
@@ -350,57 +353,6 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
}
/**
- * Data provider for testGetSortParams
- *
- * @return array parameters and output
- */
- public function dataProviderForGetSortParams()
- {
- return array(
- array('', array(array(''), array(''), array(''))),
- array(
- '`a_sales`.`customer_id` ASC',
- array(
- array('`a_sales`.`customer_id` ASC'),
- array('`a_sales`.`customer_id`'),
- array('ASC')
- )
- ),
- array(
- '`a_sales`.`customer_id` ASC, `b_sales`.`customer_id` DESC',
- array(
- array(
- '`a_sales`.`customer_id` ASC',
- '`b_sales`.`customer_id` DESC'
- ),
- array('`a_sales`.`customer_id`', '`b_sales`.`customer_id`'),
- array('ASC', 'DESC')
- )
- ),
- );
- }
-
- /**
- * Test for _getSortParams
- *
- * @param string $order_by_clause the order by clause of the sql query
- * @param string $output output of _getSortParams
- *
- * @return void
- *
- * @dataProvider dataProviderForGetSortParams
- */
- public function testGetSortParams($order_by_clause, $output)
- {
- $this->assertEquals(
- $output,
- $this->_callPrivateFunction(
- '_getSortParams', array($order_by_clause)
- )
- );
- }
-
- /**
* Data provider for testGetCheckboxForMultiRowSubmissions
*
* @return array parameters and output
@@ -1290,18 +1242,22 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
{
return array(
array(
- array(),
+ array(
+ 'analyzed_sql' => array(),
+ ),
array()
),
array(
array(
- 0 => array(
- 'where_clause_identifiers' => array(
- 0 => '`id`',
- 1 => '`id`',
- 2 => '`db_name`'
+ 'analyzed_sql' => array(
+ 0 => array(
+ 'where_clause_identifiers' => array(
+ 0 => '`id`',
+ 1 => '`id`',
+ 2 => '`db_name`'
+ )
)
- )
+ ),
),
array(
'`id`' => 'true',
diff --git a/test/classes/PMA_Util_test.php b/test/classes/PMA_Util_test.php
index e88b0237d6..034fc80bbb 100644
--- a/test/classes/PMA_Util_test.php
+++ b/test/classes/PMA_Util_test.php
@@ -18,42 +18,6 @@ require_once 'libraries/Util.class.php';
*/
class PMA_Util_Test extends PHPUnit_Framework_TestCase
{
- /**
- * Test for analyze Limit Clause
- *
- * @return void
- */
- public function testAnalyzeLimitClause()
- {
- $limit_data = PMA_Util::analyzeLimitClause("limit 2,4");
- $this->assertEquals(
- '2',
- $limit_data['start']
- );
- $this->assertEquals(
- '4',
- $limit_data['length']
- );
-
- $limit_data = PMA_Util::analyzeLimitClause("limit 3");
- $this->assertEquals(
- '0',
- $limit_data['start']
- );
- $this->assertEquals(
- '3',
- $limit_data['length']
- );
-
- $limit_data = PMA_Util::analyzeLimitClause("limit 3,2,5");
- $this->assertFalse($limit_data);
-
- $limit_data = PMA_Util::analyzeLimitClause("limit");
- $this->assertFalse($limit_data);
-
- $limit_data = PMA_Util::analyzeLimitClause("limit ");
- $this->assertFalse($limit_data);
- }
/**
* Test for createGISData