From a4472166bd936d589d23e41c94229a7d79d33d00 Mon Sep 17 00:00:00 2001 From: Yasitha Pandithawatta Date: Thu, 31 May 2012 00:25:24 +0530 Subject: [PATCH 1/2] fixed test case errors --- test/classes/PMA_Theme_test.php | 3 +++ test/libraries/core/PMA_fatalError_test.php | 2 ++ test/libraries/core/PMA_getTableCount_test_dis.php | 1 + test/libraries/js_escape_test.php | 9 +++++++++ test/libraries/php-gettext/Parsing_test.php | 2 +- 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/test/classes/PMA_Theme_test.php b/test/classes/PMA_Theme_test.php index 4608515b85..c7a22b66bf 100644 --- a/test/classes/PMA_Theme_test.php +++ b/test/classes/PMA_Theme_test.php @@ -2,6 +2,9 @@ /* vim: set expandtab sw=4 ts=4 sts=4: */ require_once 'libraries/Theme.class.php'; +require_once 'libraries/Theme_Manager.class.php'; +require_once 'libraries/php-gettext/gettext.inc'; +require_once 'libraries/sqlparser.lib.php'; /** * Test class for PMA_Theme. diff --git a/test/libraries/core/PMA_fatalError_test.php b/test/libraries/core/PMA_fatalError_test.php index 8e0a4e2aa6..dc4777f15d 100644 --- a/test/libraries/core/PMA_fatalError_test.php +++ b/test/libraries/core/PMA_fatalError_test.php @@ -16,6 +16,8 @@ require_once 'libraries/select_lang.lib.php'; require_once 'libraries/core.lib.php'; require_once 'libraries/sanitizing.lib.php'; require_once 'libraries/Config.class.php'; +require_once 'libraries/vendor_config.php'; +require_once 'libraries/php-gettext/gettext.inc'; class PMA_fatalError_test extends PHPUnit_Framework_TestCase { diff --git a/test/libraries/core/PMA_getTableCount_test_dis.php b/test/libraries/core/PMA_getTableCount_test_dis.php index 507afe045f..aa9af73708 100644 --- a/test/libraries/core/PMA_getTableCount_test_dis.php +++ b/test/libraries/core/PMA_getTableCount_test_dis.php @@ -15,6 +15,7 @@ require_once 'libraries/common.lib.php'; require_once 'libraries/config.default.php'; require_once 'libraries/Config.class.php'; require_once 'libraries/database_interface.lib.php'; +require_once 'libraries/vendor_config.php'; require_once 'config.sample.inc.php'; diff --git a/test/libraries/js_escape_test.php b/test/libraries/js_escape_test.php index d8ce4568ff..fd7b35c44c 100644 --- a/test/libraries/js_escape_test.php +++ b/test/libraries/js_escape_test.php @@ -10,6 +10,7 @@ * Include to test. */ require_once 'libraries/js_escape.lib.php'; +require_once 'libraries/common.lib.php'; class PMA_JS_Escape_test extends PHPUnit_Framework_TestCase { @@ -19,7 +20,15 @@ class PMA_JS_Escape_test extends PHPUnit_Framework_TestCase public function testFormat($key, $value, $expected) { $this->assertEquals($expected, PMA_getJsValue($key, $value)); + $this->assertEquals('foo = 100', PMA_getJsValue('foo', '100', false)); + $array = array('1','2','3'); + $this->assertEquals("foo = [\"1\",\"2\",\"3\",];\n", PMA_getJsValue('foo', $array)); } + + public function testPMA_jsFormat(){ + $this->assertEquals("`foo`", PMA_jsFormat('foo')); + } + public function variables() { diff --git a/test/libraries/php-gettext/Parsing_test.php b/test/libraries/php-gettext/Parsing_test.php index 4f1795cc93..8d9837736d 100644 --- a/test/libraries/php-gettext/Parsing_test.php +++ b/test/libraries/php-gettext/Parsing_test.php @@ -5,7 +5,7 @@ * * @package PhpMyAdmin-test */ -//require_once('gettext.php'); +require_once 'libraries/php-gettext/gettext.php'; class ParsingTest extends PHPUnit_Framework_TestCase { From c6f70c2fe32c390794e5b30c88481214e26e8c32 Mon Sep 17 00:00:00 2001 From: Yasitha Pandithawatta Date: Sat, 2 Jun 2012 00:58:48 +0530 Subject: [PATCH 2/2] improve code coverage in PMA_GIS_Geometry_test.php --- test/classes/gis/PMA_GIS_Geometry_test.php | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/test/classes/gis/PMA_GIS_Geometry_test.php b/test/classes/gis/PMA_GIS_Geometry_test.php index 080707addd..ebfb54ea8a 100644 --- a/test/classes/gis/PMA_GIS_Geometry_test.php +++ b/test/classes/gis/PMA_GIS_Geometry_test.php @@ -244,5 +244,68 @@ class PMA_GIS_GeometryTest extends PHPUnit_Framework_TestCase ), ); } + + /** + * + * @param type $srid + * @param type $scale_data + * @param type $output + * @dataProvider providerForTestGetBoundsForOl + */ + public function testGetBoundsForOl($srid, $scale_data, $output){ + + $this->assertEquals( + $this->_callProtectedFunction( + 'getBoundsForOl', + array($srid, $scale_data) + ), + $output + ); + } + + public function providerForTestGetBoundsForOl() { + return array( + array( + 4326, + array( + 'minX' => '0', + 'minY' => '0', + 'maxX' => '1', + 'maxY' => '1' + ), + 'bound = new OpenLayers.Bounds(); bound.extend(new OpenLayers.LonLat(0, 0).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())); bound.extend(new OpenLayers.LonLat(1, 1).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));' + ), + ); + + } + + /** + * + * @param type $polygons + * @param type $srid + * @param type $output + * + *@dataProvider providerForTestGetPolygonArrayForOpenLayers + */ + public function testGetPolygonArrayForOpenLayers($polygons, $srid, $output){ + $this->assertEquals( + $this->_callProtectedFunction( + 'getPolygonArrayForOpenLayers', + array($polygons, $srid) + ), + $output + ); + } + + public function providerForTestGetPolygonArrayForOpenLayers(){ + + return array( + + + ); + + } + + } ?>