/**
  * @dataProvider createRouteProvider
  */
 public function testCreateRoute($coordinates, $loggerMsg, $inputRouteCount)
 {
     $this->object->setLogger($this->logger);
     $route = $this->object->createRoute($coordinates);
     $inputRouteCoordinates = $route->getInputRoute();
     self::assertEquals($inputRouteCount, count($inputRouteCoordinates));
     foreach ($inputRouteCoordinates as $coordinate) {
         self::assertTrue($coordinate instanceof Coordinate);
     }
     if ($loggerMsg) {
         self::assertTrue($this->logger->hasRecord($loggerMsg));
     }
 }
 /**
  * @dataProvider getDirectionsProvider()
  */
 public function testGetDirections($coordinates, $remainingCountAfterFirstRequest, $initialRemainingCoordinates, $expectedNoRequests)
 {
     $actualNoRequests = 0;
     $routeFactory = new RouteFactory();
     $route = $routeFactory->createRoute($coordinates);
     self::assertEquals($initialRemainingCoordinates, $route->getRemainingCoordinateCount());
     while ($route->getRemainingCoordinateCount()) {
         $actual = $this->object->getDirections($route);
         $actualNoRequests++;
         if (1 == $actualNoRequests) {
             self::assertEquals($remainingCountAfterFirstRequest, $actual->getRemainingCoordinateCount());
         }
     }
     self::assertEquals($expectedNoRequests, $actualNoRequests);
     self::assertEquals(0, $actual->getRemainingCoordinateCount());
     self::assertTrue(is_array($route->getInterpolatedRoute()));
 }
 /**
  * @dataProvider getDirectionsProvider()
  */
 public function testGetDirections500($coordinates, $remainingCoordinateCount, $initialCoordinateCount)
 {
     $obj = new Client('abcdefg', new Polyline(), $this->get500Mock());
     $obj->setLogger($this->logger);
     $routeFactory = new RouteFactory();
     $route = $routeFactory->createRoute($coordinates);
     $result = $obj->getDirections($route);
     self::assertTrue($this->logger->hasRecord('error Server error: `GET https://maps.googleapis.com/maps/api/directions/json?origin=50.1109756,' . '8.6824697&destination=50.1320079,8.6829269&waypoints=via:50.1131057,8.6935646%7Cvia:50.1114651,' . '8.704576%7Cvia:50.1128467,8.7049644%7Cvia:50.1173763,8.7084722%7Cvia:50.1292499,8.6924497&key=' . 'abcdefg` resulted in a `500 Internal Server Error` response:'));
     self::assertEquals($route, $result);
 }