Remove Gis\GisGeomTestCase::$object property
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
cce67c26c1
commit
a68e74f737
@ -10150,16 +10150,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisFactoryTest.php
|
||||
|
||||
-
|
||||
message: "#^Class PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeomTestCase has an uninitialized property \\$object\\. Give it default value or assign it in the constructor\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeomTestCase.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeomTestCase\\:\\:testGenerateParams\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeomTestCase.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeometryCollectionTest\\:\\:providerForPrepareRowAsOl\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10175,26 +10165,11 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeometryCollectionTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeometryCollectionTest\\:\\:providerForTestGenerateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeometryCollectionTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeometryCollectionTest\\:\\:providerForTestGenerateWkt\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeometryCollectionTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeometryCollectionTest\\:\\:providerForTestScaleRow\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeometryCollectionTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeometryCollectionTest\\:\\:testGenerateWkt\\(\\) has parameter \\$gis_data with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeometryCollectionTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeometryCollectionTest\\:\\:testPrepareRowAsPdf\\(\\) has parameter \\$scale_data with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10250,16 +10225,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisLineStringTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisLineStringTest\\:\\:providerForTestGenerateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisLineStringTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisLineStringTest\\:\\:providerForTestGenerateWkt\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisLineStringTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisLineStringTest\\:\\:providerForTestScaleRow\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10275,11 +10240,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisLineStringTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getShape\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiLineStringTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisMultiLineStringTest\\:\\:providerForPrepareRowAsOl\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10295,16 +10255,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiLineStringTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisMultiLineStringTest\\:\\:providerForTestGenerateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiLineStringTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisMultiLineStringTest\\:\\:providerForTestGenerateWkt\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiLineStringTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisMultiLineStringTest\\:\\:providerForTestScaleRow\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10320,11 +10270,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiLineStringTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getShape\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiPointTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisMultiPointTest\\:\\:providerForPrepareRowAsOl\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10340,16 +10285,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiPointTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisMultiPointTest\\:\\:providerForTestGenerateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiPointTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisMultiPointTest\\:\\:providerForTestGenerateWkt\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiPointTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisMultiPointTest\\:\\:providerForTestScaleRow\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10365,11 +10300,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiPointTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getShape\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiPolygonTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisMultiPolygonTest\\:\\:getData\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10390,16 +10320,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiPolygonTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisMultiPolygonTest\\:\\:providerForTestGenerateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiPolygonTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisMultiPolygonTest\\:\\:providerForTestGenerateWkt\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiPolygonTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisMultiPolygonTest\\:\\:providerForTestGetShape\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10425,11 +10345,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisMultiPolygonTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getShape\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisPointTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisPointTest\\:\\:providerForPrepareRowAsOl\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10445,16 +10360,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisPointTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisPointTest\\:\\:providerForTestGenerateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisPointTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisPointTest\\:\\:providerForTestGenerateWkt\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisPointTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisPointTest\\:\\:providerForTestGetShape\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10480,26 +10385,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisPointTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:area\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisPolygonTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getPointOnSurface\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisPolygonTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:isOuterRing\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisPolygonTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:isPointInsidePolygon\\(\\)\\.$#"
|
||||
count: 2
|
||||
path: test/classes/Gis/GisPolygonTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisPolygonTest\\:\\:getData\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10530,16 +10415,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisPolygonTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisPolygonTest\\:\\:providerForTestGenerateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisPolygonTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisPolygonTest\\:\\:providerForTestGenerateWkt\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisPolygonTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisPolygonTest\\:\\:providerForTestGetPointOnSurface\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
|
||||
@ -7325,9 +7325,6 @@
|
||||
<code>$black</code>
|
||||
<code>$line_color</code>
|
||||
</PossiblyFalseArgument>
|
||||
<PossiblyUnusedMethod>
|
||||
<code>getShape</code>
|
||||
</PossiblyUnusedMethod>
|
||||
<RedundantPropertyInitializationCheck>
|
||||
<code>isset(self::$instance)</code>
|
||||
</RedundantPropertyInitializationCheck>
|
||||
@ -7357,9 +7354,6 @@
|
||||
<code>$black</code>
|
||||
<code>$point_color</code>
|
||||
</PossiblyFalseArgument>
|
||||
<PossiblyUnusedMethod>
|
||||
<code>getShape</code>
|
||||
</PossiblyUnusedMethod>
|
||||
<RedundantPropertyInitializationCheck>
|
||||
<code>isset(self::$instance)</code>
|
||||
</RedundantPropertyInitializationCheck>
|
||||
@ -7459,9 +7453,6 @@
|
||||
<code>$black</code>
|
||||
<code>$fill_color</code>
|
||||
</PossiblyFalseArgument>
|
||||
<PossiblyUnusedMethod>
|
||||
<code>getShape</code>
|
||||
</PossiblyUnusedMethod>
|
||||
<RedundantPropertyInitializationCheck>
|
||||
<code>isset(self::$instance)</code>
|
||||
</RedundantPropertyInitializationCheck>
|
||||
@ -7487,9 +7478,6 @@
|
||||
<code>$black</code>
|
||||
<code>$point_color</code>
|
||||
</PossiblyFalseArgument>
|
||||
<PossiblyUnusedMethod>
|
||||
<code>getShape</code>
|
||||
</PossiblyUnusedMethod>
|
||||
<RedundantPropertyInitializationCheck>
|
||||
<code>isset(self::$instance)</code>
|
||||
</RedundantPropertyInitializationCheck>
|
||||
@ -15694,12 +15682,6 @@
|
||||
<code>testFactory</code>
|
||||
</PossiblyInvalidArgument>
|
||||
</file>
|
||||
<file src="test/classes/Gis/GisGeomTestCase.php">
|
||||
<UndefinedMethod>
|
||||
<code>testGenerateParams</code>
|
||||
<code>testScaleRow</code>
|
||||
</UndefinedMethod>
|
||||
</file>
|
||||
<file src="test/classes/Gis/GisGeometryCollectionTest.php">
|
||||
<MixedInferredReturnType>
|
||||
<code>array</code>
|
||||
@ -15707,10 +15689,6 @@
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
</MixedInferredReturnType>
|
||||
<PossiblyUnusedMethod>
|
||||
<code>providerForTestGenerateParams</code>
|
||||
<code>providerForTestScaleRow</code>
|
||||
</PossiblyUnusedMethod>
|
||||
</file>
|
||||
<file src="test/classes/Gis/GisGeometryTest.php">
|
||||
<MixedAssignment>
|
||||
@ -15727,42 +15705,24 @@
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
</MixedInferredReturnType>
|
||||
<PossiblyUnusedMethod>
|
||||
<code>providerForTestGenerateParams</code>
|
||||
<code>providerForTestGenerateWkt</code>
|
||||
<code>providerForTestScaleRow</code>
|
||||
</PossiblyUnusedMethod>
|
||||
</file>
|
||||
<file src="test/classes/Gis/GisMultiLineStringTest.php">
|
||||
<MixedInferredReturnType>
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
</MixedInferredReturnType>
|
||||
<PossiblyUnusedMethod>
|
||||
<code>providerForTestGenerateParams</code>
|
||||
<code>providerForTestGenerateWkt</code>
|
||||
<code>providerForTestScaleRow</code>
|
||||
</PossiblyUnusedMethod>
|
||||
<UndefinedMethod>
|
||||
<code>getShape</code>
|
||||
</UndefinedMethod>
|
||||
</file>
|
||||
<file src="test/classes/Gis/GisMultiPointTest.php">
|
||||
<MixedInferredReturnType>
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
</MixedInferredReturnType>
|
||||
<PossiblyUnusedMethod>
|
||||
<code>providerForTestGenerateParams</code>
|
||||
<code>providerForTestGenerateWkt</code>
|
||||
<code>providerForTestScaleRow</code>
|
||||
</PossiblyUnusedMethod>
|
||||
<UndefinedMethod>
|
||||
<code>getShape</code>
|
||||
</UndefinedMethod>
|
||||
</file>
|
||||
<file src="test/classes/Gis/GisMultiPolygonTest.php">
|
||||
<MixedArrayAssignment>
|
||||
@ -15778,15 +15738,8 @@
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
</MixedInferredReturnType>
|
||||
<PossiblyUnusedMethod>
|
||||
<code>providerForTestGenerateParams</code>
|
||||
<code>providerForTestGenerateWkt</code>
|
||||
<code>providerForTestScaleRow</code>
|
||||
</PossiblyUnusedMethod>
|
||||
<UndefinedMethod>
|
||||
<code>getShape</code>
|
||||
</UndefinedMethod>
|
||||
</file>
|
||||
<file src="test/classes/Gis/GisPointTest.php">
|
||||
<MixedInferredReturnType>
|
||||
@ -15794,15 +15747,8 @@
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
</MixedInferredReturnType>
|
||||
<PossiblyUnusedMethod>
|
||||
<code>providerForTestGenerateParams</code>
|
||||
<code>providerForTestGenerateWkt</code>
|
||||
<code>providerForTestScaleRow</code>
|
||||
</PossiblyUnusedMethod>
|
||||
<UndefinedMethod>
|
||||
<code>getShape</code>
|
||||
</UndefinedMethod>
|
||||
</file>
|
||||
<file src="test/classes/Gis/GisPolygonTest.php">
|
||||
<MixedArrayAccess>
|
||||
@ -15829,19 +15775,8 @@
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
<code>array</code>
|
||||
</MixedInferredReturnType>
|
||||
<PossiblyUnusedMethod>
|
||||
<code>providerForTestGenerateParams</code>
|
||||
<code>providerForTestGenerateWkt</code>
|
||||
<code>providerForTestScaleRow</code>
|
||||
</PossiblyUnusedMethod>
|
||||
<UndefinedMethod>
|
||||
<code>area</code>
|
||||
<code>getPointOnSurface</code>
|
||||
<code>isOuterRing</code>
|
||||
<code>isPointInsidePolygon</code>
|
||||
<code>isPointInsidePolygon</code>
|
||||
</UndefinedMethod>
|
||||
</file>
|
||||
<file src="test/classes/Gis/GisVisualizationTest.php">
|
||||
<MixedAssignment>
|
||||
|
||||
@ -7,8 +7,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Gis;
|
||||
|
||||
use PhpMyAdmin\Gis\GisGeometry;
|
||||
use PhpMyAdmin\Gis\ScaleData;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use ReflectionProperty;
|
||||
use TCPDF;
|
||||
@ -26,8 +24,6 @@ abstract class GisGeomTestCase extends AbstractTestCase
|
||||
{
|
||||
protected string $testDir = '';
|
||||
|
||||
protected GisGeometry $object;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
@ -45,38 +41,6 @@ abstract class GisGeomTestCase extends AbstractTestCase
|
||||
return $arch;
|
||||
}
|
||||
|
||||
/**
|
||||
* test generateParams method
|
||||
*
|
||||
* @param string $wkt point in WKT form
|
||||
* @param array $params expected output array
|
||||
*
|
||||
* @dataProvider providerForTestGenerateParams
|
||||
*/
|
||||
public function testGenerateParams(string $wkt, array $params): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
$params,
|
||||
$this->object->generateParams($wkt),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* test scaleRow method
|
||||
*
|
||||
* @param string $spatial spatial data of a row
|
||||
* @param ScaleData $min_max expected results
|
||||
*
|
||||
* @dataProvider providerForTestScaleRow
|
||||
*/
|
||||
public function testScaleRow(string $spatial, ScaleData $min_max): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
$min_max,
|
||||
$this->object->scaleRow($spatial),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new pdf document with predictable timestamps and ids.
|
||||
*
|
||||
|
||||
@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Gis;
|
||||
|
||||
use PhpMyAdmin\Gis\GisGeometry;
|
||||
use PhpMyAdmin\Gis\GisGeometryCollection;
|
||||
use PhpMyAdmin\Gis\ScaleData;
|
||||
use PhpMyAdmin\Image\ImageWrapper;
|
||||
@ -17,30 +16,6 @@ use TCPDF;
|
||||
*/
|
||||
class GisGeometryCollectionTest extends GisGeomTestCase
|
||||
{
|
||||
protected GisGeometry $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->object = GisGeometryCollection::singleton();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
unset($this->object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testScaleRow() test case
|
||||
*
|
||||
@ -56,28 +31,40 @@ class GisGeometryCollectionTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* test scaleRow method
|
||||
*
|
||||
* @param string $spatial spatial data of a row
|
||||
* @param ScaleData $min_max expected results
|
||||
*
|
||||
* @dataProvider providerForTestScaleRow
|
||||
*/
|
||||
public function testScaleRow(string $spatial, ScaleData $min_max): void
|
||||
{
|
||||
$object = GisGeometryCollection::singleton();
|
||||
$this->assertEquals($min_max, $object->scaleRow($spatial));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for generateWkt
|
||||
*
|
||||
* @param array $gis_data
|
||||
* @param int $index index in $gis_data
|
||||
* @param string|null $empty empty parameter
|
||||
* @param string $output expected output
|
||||
* @param array<mixed> $gis_data
|
||||
* @param int $index index in $gis_data
|
||||
* @param string|null $empty empty parameter
|
||||
* @param string $output expected output
|
||||
*
|
||||
* @dataProvider providerForTestGenerateWkt
|
||||
*/
|
||||
public function testGenerateWkt(array $gis_data, int $index, string|null $empty, string $output): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
$output,
|
||||
$this->object->generateWkt($gis_data, $index, $empty),
|
||||
);
|
||||
$object = GisGeometryCollection::singleton();
|
||||
$this->assertEquals($output, $object->generateWkt($gis_data, $index, $empty));
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testGenerateWkt() test case
|
||||
*
|
||||
* @return array test data for testGenerateWkt() test case
|
||||
* @return array<array{array<mixed>, int, string|null, string}>
|
||||
*/
|
||||
public static function providerForTestGenerateWkt(): array
|
||||
{
|
||||
@ -108,10 +95,24 @@ class GisGeometryCollectionTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* test generateParams method
|
||||
*
|
||||
* @param string $wkt point in WKT form
|
||||
* @param array<mixed> $params expected output array
|
||||
*
|
||||
* @dataProvider providerForTestGenerateParams
|
||||
*/
|
||||
public function testGenerateParams(string $wkt, array $params): void
|
||||
{
|
||||
$object = GisGeometryCollection::singleton();
|
||||
$this->assertEquals($params, $object->generateParams($wkt));
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testGenerateParams() test case
|
||||
*
|
||||
* @return array test data for testGenerateParams() test case
|
||||
* @return array<array{string, array<mixed>}>
|
||||
*/
|
||||
public static function providerForTestGenerateParams(): array
|
||||
{
|
||||
@ -329,9 +330,10 @@ class GisGeometryCollectionTest extends GisGeomTestCase
|
||||
/** @requires extension gd */
|
||||
public function testPrepareRowAsPng(): void
|
||||
{
|
||||
$object = GisGeometryCollection::singleton();
|
||||
$image = ImageWrapper::create(200, 124, ['red' => 229, 'green' => 229, 'blue' => 229]);
|
||||
$this->assertNotNull($image);
|
||||
$return = $this->object->prepareRowAsPng(
|
||||
$return = $object->prepareRowAsPng(
|
||||
'GEOMETRYCOLLECTION(POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20,20 30)),'
|
||||
. 'LINESTRING(5 30,4 4))',
|
||||
'image',
|
||||
@ -366,7 +368,8 @@ class GisGeometryCollectionTest extends GisGeomTestCase
|
||||
array $scale_data,
|
||||
TCPDF $pdf,
|
||||
): void {
|
||||
$return = $this->object->prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
$object = GisGeometryCollection::singleton();
|
||||
$return = $object->prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
|
||||
$fileExpected = $this->testDir . '/geometrycollection-expected.pdf';
|
||||
$fileActual = $this->testDir . '/geometrycollection-actual.pdf';
|
||||
@ -412,7 +415,8 @@ class GisGeometryCollectionTest extends GisGeomTestCase
|
||||
array $scaleData,
|
||||
string $output,
|
||||
): void {
|
||||
$svg = $this->object->prepareRowAsSvg($spatial, $label, $color, $scaleData);
|
||||
$object = GisGeometryCollection::singleton();
|
||||
$svg = $object->prepareRowAsSvg($spatial, $label, $color, $scaleData);
|
||||
$this->assertEquals($output, $svg);
|
||||
}
|
||||
|
||||
@ -460,9 +464,10 @@ class GisGeometryCollectionTest extends GisGeomTestCase
|
||||
array $color,
|
||||
string $output,
|
||||
): void {
|
||||
$object = GisGeometryCollection::singleton();
|
||||
$this->assertEquals(
|
||||
$output,
|
||||
$this->object->prepareRowAsOl(
|
||||
$object->prepareRowAsOl(
|
||||
$spatial,
|
||||
$srid,
|
||||
$label,
|
||||
|
||||
@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Gis;
|
||||
|
||||
use PhpMyAdmin\Gis\GisGeometry;
|
||||
use PhpMyAdmin\Gis\GisLineString;
|
||||
use PhpMyAdmin\Gis\ScaleData;
|
||||
use PhpMyAdmin\Image\ImageWrapper;
|
||||
@ -17,34 +16,10 @@ use TCPDF;
|
||||
*/
|
||||
class GisLineStringTest extends GisGeomTestCase
|
||||
{
|
||||
protected GisGeometry $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->object = GisLineString::singleton();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
unset($this->object);
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testGenerateWkt
|
||||
*
|
||||
* @return array data for testGenerateWkt
|
||||
* @return array<array{array<mixed>, int, string|null, string}>
|
||||
*/
|
||||
public static function providerForTestGenerateWkt(): array
|
||||
{
|
||||
@ -106,10 +81,40 @@ class GisLineStringTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for generateWkt
|
||||
*
|
||||
* @param array<mixed> $gis_data
|
||||
* @param int $index index in $gis_data
|
||||
* @param string|null $empty empty parameter
|
||||
* @param string $output expected output
|
||||
*
|
||||
* @dataProvider providerForTestGenerateWkt
|
||||
*/
|
||||
public function testGenerateWkt(array $gis_data, int $index, string|null $empty, string $output): void
|
||||
{
|
||||
$object = GisLineString::singleton();
|
||||
$this->assertEquals($output, $object->generateWkt($gis_data, $index, $empty));
|
||||
}
|
||||
|
||||
/**
|
||||
* test generateParams method
|
||||
*
|
||||
* @param string $wkt point in WKT form
|
||||
* @param array<mixed> $params expected output array
|
||||
*
|
||||
* @dataProvider providerForTestGenerateParams
|
||||
*/
|
||||
public function testGenerateParams(string $wkt, array $params): void
|
||||
{
|
||||
$object = GisLineString::singleton();
|
||||
$this->assertEquals($params, $object->generateParams($wkt));
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testGenerateParams
|
||||
*
|
||||
* @return array data for testGenerateParams
|
||||
* @return array<array{string, array<mixed>}>
|
||||
*/
|
||||
public static function providerForTestGenerateParams(): array
|
||||
{
|
||||
@ -136,6 +141,20 @@ class GisLineStringTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* test scaleRow method
|
||||
*
|
||||
* @param string $spatial spatial data of a row
|
||||
* @param ScaleData $min_max expected results
|
||||
*
|
||||
* @dataProvider providerForTestScaleRow
|
||||
*/
|
||||
public function testScaleRow(string $spatial, ScaleData $min_max): void
|
||||
{
|
||||
$object = GisLineString::singleton();
|
||||
$this->assertEquals($min_max, $object->scaleRow($spatial));
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testScaleRow
|
||||
*
|
||||
@ -154,9 +173,10 @@ class GisLineStringTest extends GisGeomTestCase
|
||||
/** @requires extension gd */
|
||||
public function testPrepareRowAsPng(): void
|
||||
{
|
||||
$object = GisLineString::singleton();
|
||||
$image = ImageWrapper::create(200, 124, ['red' => 229, 'green' => 229, 'blue' => 229]);
|
||||
$this->assertNotNull($image);
|
||||
$return = $this->object->prepareRowAsPng(
|
||||
$return = $object->prepareRowAsPng(
|
||||
'LINESTRING(12 35,48 75,69 23,25 45,14 53,35 78)',
|
||||
'image',
|
||||
[176, 46, 224],
|
||||
@ -189,7 +209,8 @@ class GisLineStringTest extends GisGeomTestCase
|
||||
array $scale_data,
|
||||
TCPDF $pdf,
|
||||
): void {
|
||||
$return = $this->object->prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
$object = GisLineString::singleton();
|
||||
$return = $object->prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
|
||||
$fileExpected = $this->testDir . '/linestring-expected.pdf';
|
||||
$fileActual = $this->testDir . '/linestring-actual.pdf';
|
||||
@ -234,7 +255,8 @@ class GisLineStringTest extends GisGeomTestCase
|
||||
array $scaleData,
|
||||
string $output,
|
||||
): void {
|
||||
$svg = $this->object->prepareRowAsSvg($spatial, $label, $color, $scaleData);
|
||||
$object = GisLineString::singleton();
|
||||
$svg = $object->prepareRowAsSvg($spatial, $label, $color, $scaleData);
|
||||
$this->assertEquals($output, $svg);
|
||||
}
|
||||
|
||||
@ -281,7 +303,8 @@ class GisLineStringTest extends GisGeomTestCase
|
||||
array $color,
|
||||
string $output,
|
||||
): void {
|
||||
$ol = $this->object->prepareRowAsOl($spatial, $srid, $label, $color);
|
||||
$object = GisLineString::singleton();
|
||||
$ol = $object->prepareRowAsOl($spatial, $srid, $label, $color);
|
||||
$this->assertEquals($output, $ol);
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Gis;
|
||||
|
||||
use PhpMyAdmin\Gis\GisGeometry;
|
||||
use PhpMyAdmin\Gis\GisMultiLineString;
|
||||
use PhpMyAdmin\Gis\ScaleData;
|
||||
use PhpMyAdmin\Image\ImageWrapper;
|
||||
@ -17,34 +16,10 @@ use TCPDF;
|
||||
*/
|
||||
class GisMultiLineStringTest extends GisGeomTestCase
|
||||
{
|
||||
protected GisGeometry $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->object = GisMultiLineString::singleton();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
unset($this->object);
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testGenerateWkt
|
||||
*
|
||||
* @return array data for testGenerateWkt
|
||||
* @return array<array{array<mixed>, int, string|null, string}>
|
||||
*/
|
||||
public static function providerForTestGenerateWkt(): array
|
||||
{
|
||||
@ -94,13 +69,6 @@ class GisMultiLineStringTest extends GisGeomTestCase
|
||||
null,
|
||||
'MULTILINESTRING((5.02 8.45,6.14 0.15),(1.23 4.25,9.15 0.47))',
|
||||
],
|
||||
// values at undefined index
|
||||
[
|
||||
$temp,
|
||||
1,
|
||||
null,
|
||||
'MULTILINESTRING(( , ))',
|
||||
],
|
||||
// if a coordinate is missing, default is empty string
|
||||
[
|
||||
$temp1,
|
||||
@ -132,6 +100,22 @@ class GisMultiLineStringTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for generateWkt
|
||||
*
|
||||
* @param array<mixed> $gis_data
|
||||
* @param int $index index in $gis_data
|
||||
* @param string|null $empty empty parameter
|
||||
* @param string $output expected output
|
||||
*
|
||||
* @dataProvider providerForTestGenerateWkt
|
||||
*/
|
||||
public function testGenerateWkt(array $gis_data, int $index, string|null $empty, string $output): void
|
||||
{
|
||||
$object = GisMultiLineString::singleton();
|
||||
$this->assertEquals($output, $object->generateWkt($gis_data, $index, $empty));
|
||||
}
|
||||
|
||||
/**
|
||||
* test getShape method
|
||||
*/
|
||||
@ -167,16 +151,31 @@ class GisMultiLineStringTest extends GisGeomTestCase
|
||||
],
|
||||
];
|
||||
|
||||
$object = GisMultiLineString::singleton();
|
||||
$this->assertEquals(
|
||||
'MULTILINESTRING((5.02 8.45,6.14 0.15),(1.23 4.25,9.15 0.47))',
|
||||
$this->object->getShape($row_data),
|
||||
$object->getShape($row_data),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* test generateParams method
|
||||
*
|
||||
* @param string $wkt point in WKT form
|
||||
* @param array<mixed> $params expected output array
|
||||
*
|
||||
* @dataProvider providerForTestGenerateParams
|
||||
*/
|
||||
public function testGenerateParams(string $wkt, array $params): void
|
||||
{
|
||||
$object = GisMultiLineString::singleton();
|
||||
$this->assertEquals($params, $object->generateParams($wkt));
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testGenerateParams
|
||||
*
|
||||
* @return array data for testGenerateParams
|
||||
* @return array<array{string, array<mixed>}>
|
||||
*/
|
||||
public static function providerForTestGenerateParams(): array
|
||||
{
|
||||
@ -217,6 +216,20 @@ class GisMultiLineStringTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* test scaleRow method
|
||||
*
|
||||
* @param string $spatial spatial data of a row
|
||||
* @param ScaleData $min_max expected results
|
||||
*
|
||||
* @dataProvider providerForTestScaleRow
|
||||
*/
|
||||
public function testScaleRow(string $spatial, ScaleData $min_max): void
|
||||
{
|
||||
$object = GisMultiLineString::singleton();
|
||||
$this->assertEquals($min_max, $object->scaleRow($spatial));
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testScaleRow
|
||||
*
|
||||
@ -235,9 +248,10 @@ class GisMultiLineStringTest extends GisGeomTestCase
|
||||
/** @requires extension gd */
|
||||
public function testPrepareRowAsPng(): void
|
||||
{
|
||||
$object = GisMultiLineString::singleton();
|
||||
$image = ImageWrapper::create(200, 124, ['red' => 229, 'green' => 229, 'blue' => 229]);
|
||||
$this->assertNotNull($image);
|
||||
$return = $this->object->prepareRowAsPng(
|
||||
$return = $object->prepareRowAsPng(
|
||||
'MULTILINESTRING((36 14,47 23,62 75),(36 10,17 23,178 53))',
|
||||
'image',
|
||||
[176, 46, 224],
|
||||
@ -270,7 +284,8 @@ class GisMultiLineStringTest extends GisGeomTestCase
|
||||
array $scale_data,
|
||||
TCPDF $pdf,
|
||||
): void {
|
||||
$return = $this->object->prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
$object = GisMultiLineString::singleton();
|
||||
$return = $object->prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
|
||||
$fileExpected = $this->testDir . '/multilinestring-expected.pdf';
|
||||
$fileActual = $this->testDir . '/multilinestring-actual.pdf';
|
||||
@ -315,7 +330,8 @@ class GisMultiLineStringTest extends GisGeomTestCase
|
||||
array $scaleData,
|
||||
string $output,
|
||||
): void {
|
||||
$svg = $this->object->prepareRowAsSvg($spatial, $label, $color, $scaleData);
|
||||
$object = GisMultiLineString::singleton();
|
||||
$svg = $object->prepareRowAsSvg($spatial, $label, $color, $scaleData);
|
||||
$this->assertEquals($output, $svg);
|
||||
}
|
||||
|
||||
@ -364,7 +380,8 @@ class GisMultiLineStringTest extends GisGeomTestCase
|
||||
array $color,
|
||||
string $output,
|
||||
): void {
|
||||
$ol = $this->object->prepareRowAsOl($spatial, $srid, $label, $color);
|
||||
$object = GisMultiLineString::singleton();
|
||||
$ol = $object->prepareRowAsOl($spatial, $srid, $label, $color);
|
||||
$this->assertEquals($output, $ol);
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Gis;
|
||||
|
||||
use PhpMyAdmin\Gis\GisGeometry;
|
||||
use PhpMyAdmin\Gis\GisMultiPoint;
|
||||
use PhpMyAdmin\Gis\ScaleData;
|
||||
use PhpMyAdmin\Image\ImageWrapper;
|
||||
@ -19,34 +18,10 @@ use function file_exists;
|
||||
*/
|
||||
class GisMultiPointTest extends GisGeomTestCase
|
||||
{
|
||||
protected GisGeometry $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->object = GisMultiPoint::singleton();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
unset($this->object);
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testGenerateWkt
|
||||
*
|
||||
* @return array data for testGenerateWkt
|
||||
* @return array<array{array<mixed>, int, string|null, string}>
|
||||
*/
|
||||
public static function providerForTestGenerateWkt(): array
|
||||
{
|
||||
@ -85,6 +60,22 @@ class GisMultiPointTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for generateWkt
|
||||
*
|
||||
* @param array<mixed> $gis_data
|
||||
* @param int $index index in $gis_data
|
||||
* @param string|null $empty empty parameter
|
||||
* @param string $output expected output
|
||||
*
|
||||
* @dataProvider providerForTestGenerateWkt
|
||||
*/
|
||||
public function testGenerateWkt(array $gis_data, int $index, string|null $empty, string $output): void
|
||||
{
|
||||
$object = GisMultiPoint::singleton();
|
||||
$this->assertEquals($output, $object->generateWkt($gis_data, $index, $empty));
|
||||
}
|
||||
|
||||
/**
|
||||
* test getShape method
|
||||
*/
|
||||
@ -104,16 +95,28 @@ class GisMultiPointTest extends GisGeomTestCase
|
||||
],
|
||||
];
|
||||
|
||||
$this->assertEquals(
|
||||
'MULTIPOINT(5.02 8.45,6.14 0.15)',
|
||||
$this->object->getShape($gis_data),
|
||||
);
|
||||
$object = GisMultiPoint::singleton();
|
||||
$this->assertEquals('MULTIPOINT(5.02 8.45,6.14 0.15)', $object->getShape($gis_data));
|
||||
}
|
||||
|
||||
/**
|
||||
* test generateParams method
|
||||
*
|
||||
* @param string $wkt point in WKT form
|
||||
* @param array<mixed> $params expected output array
|
||||
*
|
||||
* @dataProvider providerForTestGenerateParams
|
||||
*/
|
||||
public function testGenerateParams(string $wkt, array $params): void
|
||||
{
|
||||
$object = GisMultiPoint::singleton();
|
||||
$this->assertEquals($params, $object->generateParams($wkt));
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testGenerateParams
|
||||
*
|
||||
* @return array data for testGenerateParams
|
||||
* @return array<array{string, array<mixed>}>
|
||||
*/
|
||||
public static function providerForTestGenerateParams(): array
|
||||
{
|
||||
@ -140,6 +143,20 @@ class GisMultiPointTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* test scaleRow method
|
||||
*
|
||||
* @param string $spatial spatial data of a row
|
||||
* @param ScaleData $min_max expected results
|
||||
*
|
||||
* @dataProvider providerForTestScaleRow
|
||||
*/
|
||||
public function testScaleRow(string $spatial, ScaleData $min_max): void
|
||||
{
|
||||
$object = GisMultiPoint::singleton();
|
||||
$this->assertEquals($min_max, $object->scaleRow($spatial));
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testScaleRow
|
||||
*
|
||||
@ -158,9 +175,10 @@ class GisMultiPointTest extends GisGeomTestCase
|
||||
/** @requires extension gd */
|
||||
public function testPrepareRowAsPng(): void
|
||||
{
|
||||
$object = GisMultiPoint::singleton();
|
||||
$image = ImageWrapper::create(200, 124, ['red' => 229, 'green' => 229, 'blue' => 229]);
|
||||
$this->assertNotNull($image);
|
||||
$return = $this->object->prepareRowAsPng(
|
||||
$return = $object->prepareRowAsPng(
|
||||
'MULTIPOINT(12 35,48 75,69 23,25 45,14 53,35 78)',
|
||||
'image',
|
||||
[176, 46, 224],
|
||||
@ -193,7 +211,8 @@ class GisMultiPointTest extends GisGeomTestCase
|
||||
array $scale_data,
|
||||
TCPDF $pdf,
|
||||
): void {
|
||||
$return = $this->object->prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
$object = GisMultiPoint::singleton();
|
||||
$return = $object->prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
|
||||
$fileExpectedArch = $this->testDir . '/multipoint-expected-' . $this->getArch() . '.pdf';
|
||||
$fileExpectedGeneric = $this->testDir . '/multipoint-expected.pdf';
|
||||
@ -240,7 +259,8 @@ class GisMultiPointTest extends GisGeomTestCase
|
||||
array $scaleData,
|
||||
string $output,
|
||||
): void {
|
||||
$svg = $this->object->prepareRowAsSvg($spatial, $label, $color, $scaleData);
|
||||
$object = GisMultiPoint::singleton();
|
||||
$svg = $object->prepareRowAsSvg($spatial, $label, $color, $scaleData);
|
||||
$this->assertEquals($output, $svg);
|
||||
}
|
||||
|
||||
@ -295,7 +315,8 @@ class GisMultiPointTest extends GisGeomTestCase
|
||||
array $color,
|
||||
string $output,
|
||||
): void {
|
||||
$ol = $this->object->prepareRowAsOl($spatial, $srid, $label, $color);
|
||||
$object = GisMultiPoint::singleton();
|
||||
$ol = $object->prepareRowAsOl($spatial, $srid, $label, $color);
|
||||
$this->assertEquals($output, $ol);
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Gis;
|
||||
|
||||
use PhpMyAdmin\Gis\GisGeometry;
|
||||
use PhpMyAdmin\Gis\GisMultiPolygon;
|
||||
use PhpMyAdmin\Gis\ScaleData;
|
||||
use PhpMyAdmin\Image\ImageWrapper;
|
||||
@ -17,30 +16,6 @@ use TCPDF;
|
||||
*/
|
||||
class GisMultiPolygonTest extends GisGeomTestCase
|
||||
{
|
||||
protected GisGeometry $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->object = GisMultiPolygon::singleton();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
unset($this->object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide some common data to data providers
|
||||
*
|
||||
@ -122,10 +97,26 @@ class GisMultiPolygonTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for generateWkt
|
||||
*
|
||||
* @param array<mixed> $gis_data
|
||||
* @param int $index index in $gis_data
|
||||
* @param string|null $empty empty parameter
|
||||
* @param string $output expected output
|
||||
*
|
||||
* @dataProvider providerForTestGenerateWkt
|
||||
*/
|
||||
public function testGenerateWkt(array $gis_data, int $index, string|null $empty, string $output): void
|
||||
{
|
||||
$object = GisMultiPolygon::singleton();
|
||||
$this->assertEquals($output, $object->generateWkt($gis_data, $index, $empty));
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testGenerateWkt
|
||||
*
|
||||
* @return array data for testGenerateWkt
|
||||
* @return array<array{array<mixed>, int, string|null, string}>
|
||||
*/
|
||||
public static function providerForTestGenerateWkt(): array
|
||||
{
|
||||
@ -176,10 +167,24 @@ class GisMultiPolygonTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* test generateParams method
|
||||
*
|
||||
* @param string $wkt point in WKT form
|
||||
* @param array<mixed> $params expected output array
|
||||
*
|
||||
* @dataProvider providerForTestGenerateParams
|
||||
*/
|
||||
public function testGenerateParams(string $wkt, array $params): void
|
||||
{
|
||||
$object = GisMultiPolygon::singleton();
|
||||
$this->assertEquals($params, $object->generateParams($wkt));
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testGenerateParams
|
||||
*
|
||||
* @return array data for testGenerateParams
|
||||
* @return array<array{string, array<mixed>}>
|
||||
*/
|
||||
public static function providerForTestGenerateParams(): array
|
||||
{
|
||||
@ -205,7 +210,8 @@ class GisMultiPolygonTest extends GisGeomTestCase
|
||||
*/
|
||||
public function testGetShape(array $row_data, string $shape): void
|
||||
{
|
||||
$this->assertEquals($shape, $this->object->getShape($row_data));
|
||||
$object = GisMultiPolygon::singleton();
|
||||
$this->assertEquals($shape, $object->getShape($row_data));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -291,6 +297,20 @@ class GisMultiPolygonTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* test scaleRow method
|
||||
*
|
||||
* @param string $spatial spatial data of a row
|
||||
* @param ScaleData $min_max expected results
|
||||
*
|
||||
* @dataProvider providerForTestScaleRow
|
||||
*/
|
||||
public function testScaleRow(string $spatial, ScaleData $min_max): void
|
||||
{
|
||||
$object = GisMultiPolygon::singleton();
|
||||
$this->assertEquals($min_max, $object->scaleRow($spatial));
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testScaleRow
|
||||
*
|
||||
@ -314,9 +334,10 @@ class GisMultiPolygonTest extends GisGeomTestCase
|
||||
/** @requires extension gd */
|
||||
public function testPrepareRowAsPng(): void
|
||||
{
|
||||
$object = GisMultiPolygon::singleton();
|
||||
$image = ImageWrapper::create(200, 124, ['red' => 229, 'green' => 229, 'blue' => 229]);
|
||||
$this->assertNotNull($image);
|
||||
$return = $this->object->prepareRowAsPng(
|
||||
$return = $object->prepareRowAsPng(
|
||||
'MULTIPOLYGON(((5 5,95 5,95 95,5 95,5 5),(10 10,10 40,40 40,40 10,10 10),(60 60,90 60,90 90,60 90,6'
|
||||
. '0 60)),((-5 -5,-95 -5,-95 -95,-5 -95,-5 -5),(-10 -10,-10 -40,-40 -40,-40 -10,-10 -10),(-60 -60,-90'
|
||||
. ' -60,-90 -90,-60 -90,-60 -60)))',
|
||||
@ -351,7 +372,8 @@ class GisMultiPolygonTest extends GisGeomTestCase
|
||||
array $scale_data,
|
||||
TCPDF $pdf,
|
||||
): void {
|
||||
$return = $this->object->prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
$object = GisMultiPolygon::singleton();
|
||||
$return = $object->prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
|
||||
$fileExpected = $this->testDir . '/multipolygon-expected.pdf';
|
||||
$fileActual = $this->testDir . '/multipolygon-actual.pdf';
|
||||
@ -398,7 +420,8 @@ class GisMultiPolygonTest extends GisGeomTestCase
|
||||
array $scaleData,
|
||||
string $output,
|
||||
): void {
|
||||
$svg = $this->object->prepareRowAsSvg($spatial, $label, $color, $scaleData);
|
||||
$object = GisMultiPolygon::singleton();
|
||||
$svg = $object->prepareRowAsSvg($spatial, $label, $color, $scaleData);
|
||||
$this->assertEquals($output, $svg);
|
||||
}
|
||||
|
||||
@ -450,7 +473,8 @@ class GisMultiPolygonTest extends GisGeomTestCase
|
||||
array $color,
|
||||
string $output,
|
||||
): void {
|
||||
$ol = $this->object->prepareRowAsOl($spatial, $srid, $label, $color);
|
||||
$object = GisMultiPolygon::singleton();
|
||||
$ol = $object->prepareRowAsOl($spatial, $srid, $label, $color);
|
||||
$this->assertEquals($output, $ol);
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Gis;
|
||||
|
||||
use PhpMyAdmin\Gis\GisGeometry;
|
||||
use PhpMyAdmin\Gis\GisPoint;
|
||||
use PhpMyAdmin\Gis\ScaleData;
|
||||
use PhpMyAdmin\Image\ImageWrapper;
|
||||
@ -19,34 +18,10 @@ use function file_exists;
|
||||
*/
|
||||
class GisPointTest extends GisGeomTestCase
|
||||
{
|
||||
protected GisGeometry $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->object = GisPoint::singleton();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
unset($this->object);
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testGenerateWkt
|
||||
*
|
||||
* @return array data for testGenerateWkt
|
||||
* @return array<array{array<mixed>, int, string|null, string}>
|
||||
*/
|
||||
public static function providerForTestGenerateWkt(): array
|
||||
{
|
||||
@ -98,6 +73,22 @@ class GisPointTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for generateWkt
|
||||
*
|
||||
* @param array<mixed> $gis_data
|
||||
* @param int $index index in $gis_data
|
||||
* @param string|null $empty empty parameter
|
||||
* @param string $output expected output
|
||||
*
|
||||
* @dataProvider providerForTestGenerateWkt
|
||||
*/
|
||||
public function testGenerateWkt(array $gis_data, int $index, string|null $empty, string $output): void
|
||||
{
|
||||
$object = GisPoint::singleton();
|
||||
$this->assertEquals($output, $object->generateWkt($gis_data, $index, $empty));
|
||||
}
|
||||
|
||||
/**
|
||||
* test getShape method
|
||||
*
|
||||
@ -108,7 +99,8 @@ class GisPointTest extends GisGeomTestCase
|
||||
*/
|
||||
public function testGetShape(array $row_data, string $shape): void
|
||||
{
|
||||
$this->assertEquals($shape, $this->object->getShape($row_data));
|
||||
$object = GisPoint::singleton();
|
||||
$this->assertEquals($shape, $object->getShape($row_data));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -129,10 +121,24 @@ class GisPointTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* test generateParams method
|
||||
*
|
||||
* @param string $wkt point in WKT form
|
||||
* @param array<mixed> $params expected output array
|
||||
*
|
||||
* @dataProvider providerForTestGenerateParams
|
||||
*/
|
||||
public function testGenerateParams(string $wkt, array $params): void
|
||||
{
|
||||
$object = GisPoint::singleton();
|
||||
$this->assertEquals($params, $object->generateParams($wkt));
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testGenerateParams
|
||||
*
|
||||
* @return array data for testGenerateParams
|
||||
* @return array<array{string, array<mixed>}>
|
||||
*/
|
||||
public static function providerForTestGenerateParams(): array
|
||||
{
|
||||
@ -152,6 +158,20 @@ class GisPointTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* test scaleRow method
|
||||
*
|
||||
* @param string $spatial spatial data of a row
|
||||
* @param ScaleData $min_max expected results
|
||||
*
|
||||
* @dataProvider providerForTestScaleRow
|
||||
*/
|
||||
public function testScaleRow(string $spatial, ScaleData $min_max): void
|
||||
{
|
||||
$object = GisPoint::singleton();
|
||||
$this->assertEquals($min_max, $object->scaleRow($spatial));
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testScaleRow
|
||||
*
|
||||
@ -170,9 +190,10 @@ class GisPointTest extends GisGeomTestCase
|
||||
/** @requires extension gd */
|
||||
public function testPrepareRowAsPng(): void
|
||||
{
|
||||
$object = GisPoint::singleton();
|
||||
$image = ImageWrapper::create(200, 124, ['red' => 229, 'green' => 229, 'blue' => 229]);
|
||||
$this->assertNotNull($image);
|
||||
$return = $this->object->prepareRowAsPng(
|
||||
$return = $object->prepareRowAsPng(
|
||||
'POINT(12 35)',
|
||||
'image',
|
||||
[176, 46, 224],
|
||||
@ -205,7 +226,8 @@ class GisPointTest extends GisGeomTestCase
|
||||
array $scale_data,
|
||||
TCPDF $pdf,
|
||||
): void {
|
||||
$return = $this->object->prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
$object = GisPoint::singleton();
|
||||
$return = $object->prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
|
||||
$fileExpectedArch = $this->testDir . '/point-expected-' . $this->getArch() . '.pdf';
|
||||
$fileExpectedGeneric = $this->testDir . '/point-expected.pdf';
|
||||
@ -252,7 +274,8 @@ class GisPointTest extends GisGeomTestCase
|
||||
array $scaleData,
|
||||
string $output,
|
||||
): void {
|
||||
$svg = $this->object->prepareRowAsSvg($spatial, $label, $color, $scaleData);
|
||||
$object = GisPoint::singleton();
|
||||
$svg = $object->prepareRowAsSvg($spatial, $label, $color, $scaleData);
|
||||
$this->assertEquals($output, $svg);
|
||||
}
|
||||
|
||||
@ -297,7 +320,8 @@ class GisPointTest extends GisGeomTestCase
|
||||
array $color,
|
||||
string $output,
|
||||
): void {
|
||||
$ol = $this->object->prepareRowAsOl($spatial, $srid, $label, $color);
|
||||
$object = GisPoint::singleton();
|
||||
$ol = $object->prepareRowAsOl($spatial, $srid, $label, $color);
|
||||
$this->assertEquals($output, $ol);
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Gis;
|
||||
|
||||
use PhpMyAdmin\Gis\GisGeometry;
|
||||
use PhpMyAdmin\Gis\GisPolygon;
|
||||
use PhpMyAdmin\Gis\ScaleData;
|
||||
use PhpMyAdmin\Image\ImageWrapper;
|
||||
@ -17,30 +16,6 @@ use TCPDF;
|
||||
*/
|
||||
class GisPolygonTest extends GisGeomTestCase
|
||||
{
|
||||
protected GisGeometry $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->object = GisPolygon::singleton();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
unset($this->object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide some common data to data providers
|
||||
*
|
||||
@ -97,10 +72,26 @@ class GisPolygonTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for generateWkt
|
||||
*
|
||||
* @param array<mixed> $gis_data
|
||||
* @param int $index index in $gis_data
|
||||
* @param string|null $empty empty parameter
|
||||
* @param string $output expected output
|
||||
*
|
||||
* @dataProvider providerForTestGenerateWkt
|
||||
*/
|
||||
public function testGenerateWkt(array $gis_data, int $index, string|null $empty, string $output): void
|
||||
{
|
||||
$object = GisPolygon::singleton();
|
||||
$this->assertEquals($output, $object->generateWkt($gis_data, $index, $empty));
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testGenerateWkt
|
||||
*
|
||||
* @return array data for testGenerateWkt
|
||||
* @return array<array{array<mixed>, int, string|null, string}>
|
||||
*/
|
||||
public static function providerForTestGenerateWkt(): array
|
||||
{
|
||||
@ -162,10 +153,24 @@ class GisPolygonTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* test generateParams method
|
||||
*
|
||||
* @param string $wkt point in WKT form
|
||||
* @param array<mixed> $params expected output array
|
||||
*
|
||||
* @dataProvider providerForTestGenerateParams
|
||||
*/
|
||||
public function testGenerateParams(string $wkt, array $params): void
|
||||
{
|
||||
$object = GisPolygon::singleton();
|
||||
$this->assertEquals($params, $object->generateParams($wkt));
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testGenerateParams
|
||||
*
|
||||
* @return array data for testGenerateParams
|
||||
* @return array<array{string, array<mixed>}>
|
||||
*/
|
||||
public static function providerForTestGenerateParams(): array
|
||||
{
|
||||
@ -190,7 +195,8 @@ class GisPolygonTest extends GisGeomTestCase
|
||||
*/
|
||||
public function testArea(array $ring, float $area): void
|
||||
{
|
||||
$this->assertEquals($area, $this->object->area($ring));
|
||||
$object = GisPolygon::singleton();
|
||||
$this->assertEquals($area, $object->area($ring));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -272,10 +278,8 @@ class GisPolygonTest extends GisGeomTestCase
|
||||
*/
|
||||
public function testIsPointInsidePolygon(array $point, array $polygon, bool $isInside): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
$isInside,
|
||||
$this->object->isPointInsidePolygon($point, $polygon),
|
||||
);
|
||||
$object = GisPolygon::singleton();
|
||||
$this->assertEquals($isInside, $object->isPointInsidePolygon($point, $polygon));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -353,9 +357,10 @@ class GisPolygonTest extends GisGeomTestCase
|
||||
*/
|
||||
public function testGetPointOnSurface(array $ring): void
|
||||
{
|
||||
$point = $this->object->getPointOnSurface($ring);
|
||||
$object = GisPolygon::singleton();
|
||||
$point = $object->getPointOnSurface($ring);
|
||||
$this->assertIsArray($point);
|
||||
$this->assertTrue($this->object->isPointInsidePolygon($point, $ring));
|
||||
$this->assertTrue($object->isPointInsidePolygon($point, $ring));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -379,6 +384,20 @@ class GisPolygonTest extends GisGeomTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* test scaleRow method
|
||||
*
|
||||
* @param string $spatial spatial data of a row
|
||||
* @param ScaleData $min_max expected results
|
||||
*
|
||||
* @dataProvider providerForTestScaleRow
|
||||
*/
|
||||
public function testScaleRow(string $spatial, ScaleData $min_max): void
|
||||
{
|
||||
$object = GisPolygon::singleton();
|
||||
$this->assertEquals($min_max, $object->scaleRow($spatial));
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testScaleRow
|
||||
*
|
||||
@ -401,9 +420,10 @@ class GisPolygonTest extends GisGeomTestCase
|
||||
/** @requires extension gd */
|
||||
public function testPrepareRowAsPng(): void
|
||||
{
|
||||
$object = GisPolygon::singleton();
|
||||
$image = ImageWrapper::create(200, 124, ['red' => 229, 'green' => 229, 'blue' => 229]);
|
||||
$this->assertNotNull($image);
|
||||
$return = $this->object->prepareRowAsPng(
|
||||
$return = $object->prepareRowAsPng(
|
||||
'POLYGON((0 0,100 0,100 100,0 100,0 0),(10 10,10 40,40 40,40 10,10 10),(60 60,90 60,90 90,60 90,60 60))',
|
||||
'image',
|
||||
[176, 46, 224],
|
||||
@ -436,7 +456,8 @@ class GisPolygonTest extends GisGeomTestCase
|
||||
array $scale_data,
|
||||
TCPDF $pdf,
|
||||
): void {
|
||||
$return = $this->object->prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
$object = GisPolygon::singleton();
|
||||
$return = $object->prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
|
||||
|
||||
$fileExpected = $this->testDir . '/polygon-expected.pdf';
|
||||
$fileActual = $this->testDir . '/polygon-actual.pdf';
|
||||
@ -482,7 +503,8 @@ class GisPolygonTest extends GisGeomTestCase
|
||||
array $scaleData,
|
||||
string $output,
|
||||
): void {
|
||||
$svg = $this->object->prepareRowAsSvg($spatial, $label, $color, $scaleData);
|
||||
$object = GisPolygon::singleton();
|
||||
$svg = $object->prepareRowAsSvg($spatial, $label, $color, $scaleData);
|
||||
$this->assertEquals($output, $svg);
|
||||
}
|
||||
|
||||
@ -529,7 +551,8 @@ class GisPolygonTest extends GisGeomTestCase
|
||||
array $color,
|
||||
string $output,
|
||||
): void {
|
||||
$ol = $this->object->prepareRowAsOl($spatial, $srid, $label, $color);
|
||||
$object = GisPolygon::singleton();
|
||||
$ol = $object->prepareRowAsOl($spatial, $srid, $label, $color);
|
||||
$this->assertEquals($output, $ol);
|
||||
}
|
||||
|
||||
@ -564,7 +587,8 @@ class GisPolygonTest extends GisGeomTestCase
|
||||
*/
|
||||
public function testIsOuterRing(array $ring): void
|
||||
{
|
||||
$this->assertTrue($this->object->isOuterRing($ring));
|
||||
$object = GisPolygon::singleton();
|
||||
$this->assertTrue($object->isOuterRing($ring));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user