Beispiel #1
0
 public function testExceptions()
 {
     $location = new Location(42.7186, -84.46846600000001);
     $location2 = new Location(42.274919, -83.740672);
     try {
         $distance = $location->distance($location2, 'foo');
         $this->fail();
     } catch (Exception $e) {
         $this->assertEquals('Distance method not registered.', $e->getMessage());
     }
     $location->registerDistanceMethod('bar', '\\Lootils\\Geo\\DoesNotExist');
     try {
         $distance = $location->distance($location2, 'bar');
         $this->fail();
     } catch (Exception $e) {
         $this->assertEquals('The class associated with the name does not exist.', $e->getMessage());
     }
 }