コード例 #1
0
    public function testRenderJsContainerInfoWindowsWithClosableOnes()
    {
        $map = new Map();
        $map->setJavascriptVariable('map');
        $map->addInfoWindow($mapInfoWindow = new InfoWindow());
        $mapInfoWindow->setJavascriptVariable('map_info_window');
        $mapInfoWindow->setPosition(1, 2, true);
        $mapInfoWindow->getPosition()->setJavascriptVariable('map_info_window_position');
        $map->addMarker($marker = new Marker());
        $marker->setInfoWindow($markerInfoWindow = new InfoWindow());
        $markerInfoWindow->setJavascriptVariable('marker_info_window');
        $markerInfoWindow->setPosition(1, 2, true);
        $markerInfoWindow->getPosition()->setJavascriptVariable('marker_info_window_position');
        $mapInfoWindow->setAutoClose(true);
        $markerInfoWindow->setAutoClose(true);
        $expected = <<<EOF
map_container.info_windows.map_info_window = map_info_window = new google.maps.InfoWindow({"position":map_info_window_position,"content":"<p>Default content<\\/p>"});
map_container.info_windows.marker_info_window = marker_info_window = new google.maps.InfoWindow({"content":"<p>Default content<\\/p>"});
map_container.closable_info_windows.map_info_window = map_info_window;
map_container.closable_info_windows.marker_info_window = marker_info_window;

EOF;
        $this->assertSame($expected, $this->mapHelper->renderJsContainerInfoWindows($map));
    }