public function testIsValidWithLocation()
 {
     $this->directionsWaypoint->setLocation('foo');
     $this->assertTrue($this->directionsWaypoint->isValid());
 }
 /**
  * Adds a waypoint to the directions request.
  *
  * Available prototypes:
  * - function addWaypoint(Ivory\GoogleMap\Services\Directions\DirectionsWaypoint $waypoint)
  * - function addWaypoint(string $location)
  * - function addWaypoint(double $latitude, double $longitude, boolean $noWrap)
  * - function addWaypoint(Ivory\GoogleMap\Base\Coordinate $location)
  *
  * @throws \Ivory\GoogleMap\Exception\DirectionsException If the waypoint is not valid (prototypes).
  */
 public function addWaypoint()
 {
     $args = func_get_args();
     if (isset($args[0]) && $args[0] instanceof DirectionsWaypoint) {
         $this->waypoints[] = $args[0];
     } elseif (isset($args[0]) && is_numeric($args[0]) && (isset($args[1]) && is_numeric($args[1]))) {
         $waypoint = new DirectionsWaypoint();
         $waypoint->setLocation($args[0], $args[1]);
         if (isset($args[2]) && is_bool($args[2])) {
             $waypoint->getLocation()->setNoWrap($args[2]);
         }
         $this->waypoints[] = $waypoint;
     } elseif (isset($args[0]) && (is_string($args[0]) || $args[0] instanceof Coordinate)) {
         $waypoint = new DirectionsWaypoint();
         $waypoint->setLocation($args[0]);
         $this->waypoints[] = $waypoint;
     } else {
         throw DirectionsException::invalidDirectionsRequestWaypoint();
     }
 }
 public function testRouteWithDirectionsRequestAndStopoverWaypoint()
 {
     $waypoint = new DirectionsWaypoint();
     $waypoint->setLocation('Compiègne');
     $waypoint->setStopover(true);
     $request = new DirectionsRequest();
     $request->setOrigin('Lille');
     $request->addWaypoint($waypoint);
     $request->setDestination('Paris');
     $response = $this->directions->route($request);
     $this->assertSame(DirectionsStatus::OK, $response->getStatus());
     $this->assertNotEmpty($response->getRoutes());
 }