diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/classes/PMA_DisplayResults_test.php | 84 | ||||
-rw-r--r-- | test/classes/PMA_Util_test.php | 36 |
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 |