/**
  * Renders the events wraps into the event manager
  *
  * @param Ivory\GoogleMapBundle\Model\Events\EventManager $eventManager
  * @return string HTML output
  */
 public function render(EventManager $eventManager)
 {
     $html = array();
     foreach ($eventManager->getDomEvents() as $domEvent) {
         $html[] = $this->eventHelper->renderDomEvent($domEvent);
     }
     foreach ($eventManager->getDomEventsOnce() as $domEventOnce) {
         $html[] = $this->eventHelper->renderDomEventOnce($domEventOnce);
     }
     foreach ($eventManager->getEvents() as $event) {
         $html[] = $this->eventHelper->renderEvent($event);
     }
     foreach ($eventManager->getEventsOnce() as $eventOnce) {
         $html[] = $this->eventHelper->renderEventOnce($eventOnce);
     }
     return implode('', $html);
 }
 /**
  * Checks the render method
  */
 public function testRender()
 {
     $eventManagerTest = new EventManager();
     $domEventTest = new Event();
     $domEventTest->setInstance('instance');
     $domEventTest->setEventName('event_name');
     $domEventTest->setHandle('handle');
     $domEventTest->setCapture(true);
     $eventManagerTest->addDomEvent($domEventTest);
     $domEventOnceTest = new Event();
     $domEventOnceTest->setInstance('instance');
     $domEventOnceTest->setEventName('event_name');
     $domEventOnceTest->setHandle('handle');
     $domEventOnceTest->setCapture(true);
     $eventManagerTest->addDomEventOnce($domEventOnceTest);
     $eventTest = new Event();
     $eventTest->setInstance('instance');
     $eventTest->setEventName('event_name');
     $eventTest->setHandle('handle');
     $eventManagerTest->addEvent($eventTest);
     $eventOnceTest = new Event();
     $eventOnceTest->setInstance('instance');
     $eventOnceTest->setEventName('event_name');
     $eventOnceTest->setHandle('handle');
     $eventManagerTest->addEventOnce($eventOnceTest);
     $this->assertEquals(self::$eventManagerHelper->render($eventManagerTest), 'var ' . $domEventTest->getJavascriptVariable() . ' = google.maps.event.addDomListener(instance, "event_name", handle, true);' . PHP_EOL . 'var ' . $domEventOnceTest->getJavascriptVariable() . ' = google.maps.event.addDomListenerOnce(instance, "event_name", handle, true);' . PHP_EOL . 'var ' . $eventTest->getJavascriptVariable() . ' = google.maps.event.addListener(instance, "event_name", handle);' . PHP_EOL . 'var ' . $eventOnceTest->getJavascriptVariable() . ' = google.maps.event.addListenerOnce(instance, "event_name", handle);' . PHP_EOL);
 }
 /**
  * Checks the event manager getter & setter
  */
 public function testEventManager()
 {
     $eventManagerTest = new Events\EventManager();
     $eventTest = new Events\Event();
     $eventTest->setInstance('instance');
     $eventTest->setEventName('event_name');
     $eventTest->setHandle('handle');
     $eventTest->setCapture(true);
     $eventManagerTest->addEvent($eventTest);
     self::$map->setEventManager($eventManagerTest);
     $events = self::$map->getEventManager()->getEvents();
     $this->assertEquals($events[0]->getInstance(), 'instance');
     $this->assertEquals($events[0]->getEventName(), 'event_name');
     $this->assertEquals($events[0]->getHandle(), 'handle');
     $this->assertTrue($events[0]->isCapture());
 }
 /**
  * Create an event manager
  */
 public function __construct()
 {
     parent::__construct();
 }