Skip to content

Commit

Permalink
make failures output some useful information
Browse files Browse the repository at this point in the history
  • Loading branch information
mprins committed Aug 29, 2014
1 parent dd363b4 commit fe93d10
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 90 deletions.
4 changes: 2 additions & 2 deletions tests/tests/adaptersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function testAdapters() {
$adapter_loader = new $adapter_class();
$test_geom_1 = $adapter_loader->read($output);
$test_geom_2 = $adapter_loader->read($test_geom_1->out($adapter_key));
$this->assertEquals($test_geom_1->out('wkt'), $test_geom_2->out('wkt'), "Mismatched adapter output in ".$adapter_class);
$this->assertEquals($test_geom_1->out('wkt'), $test_geom_2->out('wkt'), "Mismatched adapter output in ".$adapter_class .' (test file: ' . $file . ')');
}
}
}
Expand Down Expand Up @@ -53,7 +53,7 @@ function testAdapters() {
geoPHP::geosInstalled(TRUE);

// Check to make sure a both are the same with geos and without
$this->assertEquals($test_geom_1->out('wkt'), $test_geom_2->out('wkt'), "Mismatched adapter output between GEOS and NORM in ".$adapter_class);
$this->assertEquals($test_geom_1->out('wkt'), $test_geom_2->out('wkt'), "Mismatched adapter output between GEOS and NORM in ".$adapter_class .' (test file: ' . $file . ')');
}
}
}
Expand Down
34 changes: 17 additions & 17 deletions tests/tests/aliasesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,67 +37,67 @@ function testAliases() {
switch ($alias_name) {
case 'getSRID':
if ($geometry->geometryType() == 'Point') {
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
if ($geometry->geometryType() == 'LineString') {
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
if ($geometry->geometryType() == 'MultiLineString') {
$this->assertNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
break;
case 'getGeos':
if ($geometry->geometryType() == 'Point') {
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
if ($geometry->geometryType() == 'LineString') {
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
if ($geometry->geometryType() == 'MultiLineString') {
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
break;
case 'getX':
case 'getY':
if ($geometry->geometryType() == 'Point') {
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
if ($geometry->geometryType() == 'LineString') {
$this->assertNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
if ($geometry->geometryType() == 'MultiLineString') {
$this->assertNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
break;
case 'getArea':
if ($geometry->geometryType() == 'Point') {
$this->assertNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
if ($geometry->geometryType() == 'LineString') {
$this->assertNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
if ($geometry->geometryType() == 'MultiLineString') {
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
break;
case 'getCentroid':
if ($geometry->geometryType() == 'Point') {
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
if ($geometry->geometryType() == 'LineString') {
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
if ($geometry->geometryType() == 'MultiLineString') {
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
break;
case 'asText':
case 'asBinary':
case 'getGeomType':
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertNotNull($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
break;
default:
$this->assertTrue($geometry->$alias_name($argument), 'Failed on ' . $alias_name);
$this->assertTrue($geometry->$alias_name($argument), 'Failed on ' . $alias_name .' (test file: ' . $file . ')');
}
}

Expand Down
12 changes: 6 additions & 6 deletions tests/tests/geosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,24 @@ function testGeos() {
case 'equals':
case 'geos':
if ($geometry->geometryType() == 'Point') {
$this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
$this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name .' (test file: ' . $file . ')');
}
if ($geometry->geometryType() == 'LineString') {
$this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
$this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name .' (test file: ' . $file . ')');
}
if ($geometry->geometryType() == 'MultiLineString') {
$this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
$this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name .' (test file: ' . $file . ')');
}
break;
default:
if ($geometry->geometryType() == 'Point') {
$this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
$this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name .' (test file: ' . $file . ')');
}
if ($geometry->geometryType() == 'LineString') {
$this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
$this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name .' (test file: ' . $file . ')');
}
if ($geometry->geometryType() == 'MultiLineString') {
$this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
$this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name .' (test file: ' . $file . ')');
}
}
}
Expand Down
Loading

0 comments on commit fe93d10

Please sign in to comment.