public function testRenderWithOptions()
    {
        $map = $this->getMock('Ivory\\GoogleMap\\Map');
        $map->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('map'));
        $bound = new Bound();
        $bound->setJavascriptVariable('bound');
        $bound->setSouthWest(-1.1, -2.1, true);
        $bound->setNorthEast(1.1, 2.1, true);
        $groundOverlay = new GroundOverlay('url', $bound);
        $groundOverlay->setJavascriptVariable('groundOverlay');
        $groundOverlay->setOptions(array('option1' => 'value1', 'option2' => 'value2'));
        $expected = <<<EOF
groundOverlay = new google.maps.GroundOverlay("url", bound, {"map":map,"option1":"value1","option2":"value2"});

EOF;
        $this->assertSame($expected, $this->groundOverlayHelper->render($groundOverlay, $map));
    }
Exemplo n.º 2
0
 /**
  * Renders the javascript container ground overlays.
  *
  * @param \Ivory\GoogleMap\Map $map The map.
  *
  * @return string The JS output.
  */
 public function renderJsContainerGroundOverlays(Map $map)
 {
     $output = array();
     foreach ($map->getGroundOverlays() as $groundOverlay) {
         $output[] = sprintf('%s.ground_overlays.%s = %s', $this->getJsContainerName($map), $groundOverlay->getJavascriptVariable(), $this->groundOverlayHelper->render($groundOverlay, $map));
     }
     return implode('', $output);
 }