コード例 #1
0
 public function testRender()
 {
     $map = $this->getMock('Ivory\\GoogleMap\\Map');
     $map->expects($this->once())->method('getJavascriptVariable')->will($this->returnValue('map'));
     $circle = new Circle();
     $circle->setJavascriptVariable('circle');
     $circle->setCenter(1.1, 2.1, true);
     $circle->getCenter()->setJavascriptVariable('center');
     $circle->setRadius(2);
     $circle->setOptions(array('option1' => 'value1', 'option2' => 'value2'));
     $expected = 'circle = new google.maps.Circle({' . '"map":map,' . '"center":center,' . '"radius":2,' . '"option1":"value1",' . '"option2":"value2"' . '});' . PHP_EOL;
     $this->assertSame($expected, $this->circleHelper->render($circle, $map));
 }
コード例 #2
0
 /**
  * Renders the javascript container circles.
  *
  * @param \Ivory\GoogleMap\Map $map The map.
  *
  * @return string The JS output.
  */
 public function renderJsContainerCircles(Map $map)
 {
     $output = array();
     foreach ($map->getCircles() as $circle) {
         $output[] = sprintf('%s.circles.%s = %s', $this->getJsContainerName($map), $circle->getJavascriptVariable(), $this->circleHelper->render($circle, $map));
     }
     return implode('', $output);
 }