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)); }
public function testRenderWithOptions() { $map = $this->getMock('Ivory\\GoogleMap\\Map'); $map->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('map')); $bound = new Bound(); $bound->setJavascriptVariable('rectangleBound'); $bound->setSouthWest(-1.1, -2.1); $bound->setNorthEast(1.1, 2.1); $rectangle = new Rectangle($bound); $rectangle->setJavascriptVariable('rectangle'); $rectangle->setOptions(array('option1' => 'value1', 'option2' => 'value2')); $expected = <<<EOF rectangle = new google.maps.Rectangle({"map":map,"bounds":rectangleBound,"option1":"value1","option2":"value2"}); EOF; $this->assertSame($expected, $this->rectangleHelper->render($rectangle, $map)); }
public function testRenderExtends() { $bound = new Bound(); $bound->setJavascriptVariable('bound'); $circle = $this->getMock('Ivory\\GoogleMap\\Overlays\\Circle'); $circle->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('circle')); $groundOverlayBound = $this->getMock('Ivory\\GoogleMap\\Base\\Bound'); $groundOverlayBound->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('groundOverlayBound')); $groundOverlay = $this->getMock('Ivory\\GoogleMap\\Overlays\\GroundOverlay'); $groundOverlay->expects($this->once())->method('getBound')->will($this->returnValue($groundOverlayBound)); $infoWindow = $this->getMock('Ivory\\GoogleMap\\Overlays\\InfoWindow'); $infoWindow->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('infoWindow')); $marker = $this->getMock('Ivory\\GoogleMap\\Overlays\\Marker'); $marker->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('marker')); $polygon = $this->getMock('Ivory\\GoogleMap\\Overlays\\Polygon'); $polygon->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('polygon')); $polyline = $this->getMock('Ivory\\GoogleMap\\Overlays\\Polyline'); $polyline->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('polyline')); $rectangleBound = $this->getMock('Ivory\\GoogleMap\\Base\\Bound'); $rectangleBound->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('rectangleBound')); $rectangle = $this->getMock('Ivory\\GoogleMap\\Overlays\\Rectangle'); $rectangle->expects($this->once())->method('getBound')->will($this->returnValue($rectangleBound)); $bound->extend($circle); $bound->extend($groundOverlay); $bound->extend($infoWindow); $bound->extend($marker); $bound->extend($polygon); $bound->extend($polyline); $bound->extend($rectangle); $expected = <<<EOF bound.union(circle.getBounds()); bound.union(groundOverlayBound); bound.extend(infoWindow.getPosition()); bound.extend(marker.getPosition()); polygon.getPath().forEach(function(element){bound.extend(element)}); polyline.getPath().forEach(function(element){bound.extend(element)}); bound.union(rectangleBound); EOF; $this->assertSame($expected, $this->boundHelper->renderExtends($bound)); }