Exemple #1
0
function run_test()
{
    set_time_limit(0);
    set_error_handler("FailOnError");
    header("Content-type: text");
    include_once '../geoPHP.inc';
    if (geoPHP::geosInstalled()) {
        print "GEOS is installed.\n";
    } else {
        print "GEOS is not installed.\n";
    }
    foreach (scandir('./input') as $file) {
        $parts = explode('.', $file);
        if ($parts[0]) {
            $format = $parts[1];
            $value = file_get_contents('./input/' . $file);
            print '---- Testing ' . $file . "\n";
            $geometry = geoPHP::load($value, $format);
            test_adapters($geometry, $format, $value);
            test_methods($geometry);
            test_geometry($geometry);
            test_detection($value, $format, $file);
        }
    }
    print "" . "PASS" . "\n";
}
function run_test()
{
    header("Content-type: text");
    include_once '../geoPHP.inc';
    if (geoPHP::geosInstalled()) {
        print "GEOS is installed.\n";
    } else {
        print "GEOS is not installed.\n";
    }
    foreach (scandir('./input') as $file) {
        $parts = explode('.', $file);
        if ($parts[0]) {
            $format = $parts[1];
            $value = file_get_contents('./input/' . $file);
            print '---- Testing ' . $file . "\n";
            $geometry = geoPHP::load($value, $format);
            test_adapters($geometry, $format, $value);
            test_methods($geometry);
            test_geometry($geometry);
        }
    }
    print "Testing Done!";
}
header("Content-type: text");
include_once '../geoPHP.inc';
if (geoPHP::geosInstalled()) {
    print "GEOS is installed.\n";
} else {
    print "GEOS is not installed.\n";
}
foreach (scandir('./input') as $file) {
    $parts = explode('.', $file);
    if ($parts[0]) {
        $format = $parts[1];
        $value = file_get_contents('./input/' . $file);
        print '---- Testing ' . $file . "\n";
        $geometry = geoPHP::load($value, $format);
        test_methods($geometry);
        test_geometry($geometry);
    }
}
function test_geometry($geometry, $test_adapters = TRUE)
{
    // Test common functions
    $geometry->area();
    $geometry->boundary();
    $geometry->envelope();
    $geometry->getBBox();
    $geometry->centroid();
    $geometry->length();
    $geometry->y();
    $geometry->x();
    $geometry->numGeometries();
    $geometry->geometryN(1);