Fixed: Not selecting a datalabel used to issue a notice(undefined offset)
[phpmyadmin/ammaryasirr.git] / test / classes / gis / PMA_GIS_Point_test.php
bloba25a66ab958b2e3fef08894e69c72d111d30d6b1
1 <?php
2 /**
3 * Test for PMA_GIS_Point
5 * @package phpMyAdmin-test
6 */
8 require_once 'PMA_GIS_Geometry_test.php';
9 require_once 'libraries/gis/pma_gis_geometry.php';
10 require_once 'libraries/gis/pma_gis_point.php';
12 /**
13 * Tests for PMA_GIS_Point class.
15 class PMA_GIS_PointTest extends PMA_GIS_GeometryTest
17 /**
18 * @var PMA_GIS_Point
19 * @access protected
21 protected $object;
23 /**
24 * Sets up the fixture, for example, opens a network connection.
25 * This method is called before a test is executed.
27 * @access protected
28 * @return nothing
30 protected function setUp()
32 $this->object = PMA_GIS_Point::singleton();
35 /**
36 * Tears down the fixture, for example, closes a network connection.
37 * This method is called after a test is executed.
39 * @access protected
40 * @return nothing
42 protected function tearDown()
44 unset($this->object);
47 /**
48 * data provider for testGenerateWkt
50 * @return data for testGenerateWkt
52 public function providerForTestGenerateWkt()
54 return array(
55 array(
56 array(0 => array('POINT' => array('x' => 5.02, 'y' => 8.45))),
58 null,
59 'POINT(5.02 8.45)'
61 array(
62 array(0 => array('POINT' => array('x' => 5.02, 'y' => 8.45))),
64 null,
65 'POINT( )'
67 array(
68 array(0 => array('POINT' => array('x' => 5.02))),
70 null,
71 'POINT(5.02 )'
73 array(
74 array(0 => array('POINT' => array('y' => 8.45))),
76 null,
77 'POINT( 8.45)'
79 array(
80 array(0 => array('POINT' => array())),
82 null,
83 'POINT( )'
88 /**
89 * test getShape method
91 * @param array $row_data array of GIS data
92 * @param string $shape expected shape in WKT
94 * @dataProvider providerForTestGetShape
95 * @return nothing
97 public function testGetShape($row_data, $shape)
99 $this->assertEquals($this->object->getShape($row_data), $shape);
103 * data provider for testGetShape
105 * @return data for testGetShape
107 public function providerForTestGetShape()
109 return array(
110 array(
111 array('x' => 5.02, 'y' => 8.45),
112 'POINT(5.02 8.45)'
118 * data provider for testGenerateParams
120 * @return data for testGenerateParams
122 public function providerForTestGenerateParams()
124 return array(
125 array(
126 "'POINT(5.02 8.45)',124",
127 null,
128 array(
129 'srid' => '124',
130 0 => array(
131 'POINT' => array('x' => '5.02', 'y' => '8.45')
135 array(
136 'POINT(5.02 8.45)',
138 array(
139 2 => array(
140 'gis_type' => 'POINT',
141 'POINT' => array('x' => '5.02', 'y' => '8.45')