public function testRenderLibraries() { $map = $this->getMock('Ivory\\GoogleMap\\Map'); $markerCluster = $this->getMock('Ivory\\GoogleMap\\Overlays\\MarkerCluster'); $markerCluster->expects($this->any())->method('getType')->will($this->returnValue('foo')); $helperMock = $this->getMock('Ivory\\GoogleMap\\Helper\\Overlays\\MarkerCluster\\MarkerClusterHelperInterface'); $helperMock->expects($this->once())->method('renderLibraries')->with($this->equalTo($markerCluster), $this->equalTo($map))->will($this->returnValue('bar')); $this->helper->setHelper('foo', $helperMock); $this->assertSame('bar', $this->helper->renderLibraries($markerCluster, $map)); }
/** * {@inheritdoc} */ public function renderLibraries(Map $map) { if ($this->apiHelper->isLoaded()) { return; } $callback = null; if ($map->isAsync()) { $callback = 'load_ivory_google_map'; } $output = array(); $output[] = $this->apiHelper->render($map->getLanguage(), $this->getLibraries($map), $callback, $map->getApiKey()); $output[] = $this->markerClusterHelper->renderLibraries($map->getMarkerCluster(), $map); return implode('', $output); }