コード例 #1
0
    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));
    }