function testClosestWarehouse()
 {
     $warehouse = Warehouse::closest_to($this->objFromFixture("Address", "customeraddress1"));
     $this->assertEquals("Main warehouse", $warehouse->Title);
     $warehouse = Warehouse::closest_to($this->objFromFixture("Address", "customeraddress2"));
     $this->assertEquals("NSW depot", $warehouse->Title);
 }
 public function calculateRate(ShippingPackage $package, Address $address)
 {
     $warehouse = Warehouse::closest_to($address);
     $distance = $warehouse->Address()->distanceTo($address);
     return $this->getDistanceFare($distance);
 }