From 2d322608e588225949fedbbf38805422aba52193 Mon Sep 17 00:00:00 2001 From: adamgsoc2013 Date: Thu, 16 May 2013 21:30:50 +0800 Subject: [PATCH] test case for static function of PMA_Util --- test/classes/PMA_Util_test.php | 100 +++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 test/classes/PMA_Util_test.php diff --git a/test/classes/PMA_Util_test.php b/test/classes/PMA_Util_test.php new file mode 100644 index 0000000000..52f7893fe0 --- /dev/null +++ b/test/classes/PMA_Util_test.php @@ -0,0 +1,100 @@ +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'] + ); + } + + /** + * Test for createGISData + * + * @return void + */ + public function testCreateGISData() + { + $this->assertEquals( + "abc", + PMA_Util::createGISData("abc") + ); + $this->assertEquals( + "GeomFromText('POINT()',10)", + PMA_Util::createGISData("'POINT()',10") + ); + } + + /** + * Test for getGISFunctions + * + * @return void + */ + public function testGetGISFunctions() + { + $funcs = PMA_Util::getGISFunctions(); + $this->assertArrayHasKey( + 'Dimension', + $funcs + ); + $this->assertArrayHasKey( + 'GeometryType', + $funcs + ); + $this->assertArrayHasKey( + 'MBRDisjoint', + $funcs + ); + } + + /** + * Test for Page Selector + * + * @return void + */ + public function testPageSelector() + { + $this->assertContains( + '