function MethodsTests::testMethods in geoPHP 7
Same name and namespace in other branches
- 8 geoPHP/tests/tests/methodsTest.php \MethodsTests::testMethods()
File
- geoPHP/
tests/ tests/ methodsTest.php, line 9
Class
Code
function testMethods() {
foreach (scandir('./input') as $file) {
$parts = explode('.', $file);
if ($parts[0]) {
$format = $parts[1];
$value = file_get_contents('./input/' . $file);
echo "\nloading: " . $file . " for format: " . $format;
$geometry = geoPHP::load($value, $format);
$methods = array(
array(
'name' => 'area',
),
array(
'name' => 'boundary',
),
array(
'name' => 'getBBox',
),
array(
'name' => 'centroid',
),
array(
'name' => 'length',
),
array(
'name' => 'greatCircleLength',
),
array(
'name' => 'haversineLength',
),
array(
'name' => 'y',
),
array(
'name' => 'x',
),
array(
'name' => 'numGeometries',
),
array(
'name' => 'geometryN',
'argument' => '1',
),
array(
'name' => 'startPoint',
),
array(
'name' => 'endPoint',
),
array(
'name' => 'isRing',
),
array(
'name' => 'isClosed',
),
array(
'name' => 'numPoints',
),
array(
'name' => 'pointN',
'argument' => '1',
),
array(
'name' => 'exteriorRing',
),
array(
'name' => 'numInteriorRings',
),
array(
'name' => 'interiorRingN',
'argument' => '1',
),
array(
'name' => 'dimension',
),
array(
'name' => 'geometryType',
),
array(
'name' => 'SRID',
),
array(
'name' => 'setSRID',
'argument' => '4326',
),
);
foreach ($methods as $method) {
$argument = NULL;
$method_name = $method['name'];
if (isset($method['argument'])) {
$argument = $method['argument'];
}
$this
->_methods_tester($geometry, $method_name, $argument, $file);
}
$this
->_methods_tester_with_geos($geometry);
}
}
}