/**
  * Checks the render method
  */
 public function testRender()
 {
     $mapTest = new Map();
     $markerTest = new Overlays\Marker();
     $markerTest->setPosition(new Base\Coordinate(1.1, 2.1, true));
     $markerTest->setAnimation(Overlays\Animation::BOUNCE);
     $iconTest = new Overlays\MarkerImage();
     $iconTest->setUrl('url');
     $markerTest->setIcon($iconTest);
     $shadowTest = new Overlays\MarkerImage();
     $shadowTest->setUrl('url');
     $markerTest->setShadow($shadowTest);
     $shapeTest = new Overlays\MarkerShape();
     $shapeTest->setType('poly');
     $shapeTest->setCoordinates(array(1, 2, 3, 4));
     $markerTest->setShape($shapeTest);
     $infoWindowTest = new Overlays\InfoWindow();
     $infoWindowTest->setContent('content');
     $markerTest->setInfoWindow($infoWindowTest);
     $this->assertEquals(self::$markerHelper->render($markerTest, $mapTest), 'var ' . $markerTest->getIcon()->getJavascriptVariable() . ' = new google.maps.MarkerImage("url");' . PHP_EOL . 'var ' . $markerTest->getShadow()->getJavascriptVariable() . ' = new google.maps.MarkerImage("url");' . PHP_EOL . 'var ' . $markerTest->getShape()->getJavascriptVariable() . ' = new google.maps.MarkerShape({"type":"poly","coords":[1,2,3,4]});' . PHP_EOL . 'var ' . $markerTest->getJavascriptVariable() . ' = new google.maps.Marker({"map":' . $mapTest->getJavascriptVariable() . ',"position":new google.maps.LatLng(1.1, 2.1, true), "animation":google.maps.Animation.BOUNCE, "icon":' . $markerTest->getIcon()->getJavascriptVariable() . ', "shadow":' . $markerTest->getShadow()->getJavascriptVariable() . ', "shape":' . $markerTest->getShape()->getJavascriptVariable() . '});' . PHP_EOL . 'var ' . $markerTest->getInfoWindow()->getJavascriptVariable() . ' = new google.maps.InfoWindow({"content":"content"});' . PHP_EOL);
     $markerTest->setOptions(array('option1' => 'value1', 'option2' => 'value2'));
     $this->assertEquals(self::$markerHelper->render($markerTest, $mapTest), 'var ' . $markerTest->getIcon()->getJavascriptVariable() . ' = new google.maps.MarkerImage("url");' . PHP_EOL . 'var ' . $markerTest->getShadow()->getJavascriptVariable() . ' = new google.maps.MarkerImage("url");' . PHP_EOL . 'var ' . $markerTest->getShape()->getJavascriptVariable() . ' = new google.maps.MarkerShape({"type":"poly","coords":[1,2,3,4]});' . PHP_EOL . 'var ' . $markerTest->getJavascriptVariable() . ' = new google.maps.Marker({"map":' . $mapTest->getJavascriptVariable() . ',"position":new google.maps.LatLng(1.1, 2.1, true), "animation":google.maps.Animation.BOUNCE, "icon":' . $markerTest->getIcon()->getJavascriptVariable() . ', "shadow":' . $markerTest->getShadow()->getJavascriptVariable() . ', "shape":' . $markerTest->getShape()->getJavascriptVariable() . ',"option1":"value1","option2":"value2"});' . PHP_EOL . 'var ' . $markerTest->getInfoWindow()->getJavascriptVariable() . ' = new google.maps.InfoWindow({"content":"content"});' . PHP_EOL);
 }
 /**
  * Renders the map javascript markers
  *
  * @param Ivory\GoogleMapBundle\Model\Map $map
  * @return string HTML output
  */
 public function renderMarkers(Map $map)
 {
     $html = array();
     foreach ($map->getMarkers() as $marker) {
         $html[] = $this->markerHelper->render($marker, $map);
         if ($marker->hasInfoWindow() && $marker->getInfoWindow()->isAutoOpen()) {
             $event = new Event();
             $event->setInstance($marker->getJavascriptVariable());
             $event->setEventName($marker->getInfoWindow()->getOpenEvent());
             $event->setHandle(sprintf('function(){for(var info_window in closable_info_windows){closable_info_windows[info_window].close();}%s}', str_replace(PHP_EOL, '', $this->infoWindowHelper->renderOpen($marker->getInfoWindow(), $map, $marker))));
             $map->getEventManager()->addEvent($event);
         }
     }
     return implode('', $html);
 }