public function testDefaultState() { $this->assertSame('coordinate_', substr($this->coordinate->getJavascriptVariable(), 0, 11)); $this->assertSame(0, $this->coordinate->getLatitude()); $this->assertSame(0, $this->coordinate->getLongitude()); $this->assertTrue($this->coordinate->isNoWrap()); }
/** * Renders a coordinate. * * @param \Ivory\GoogleMap\Base\Coordinate $coordinate The coordinate. * * @return string The JS output. */ public function render(Coordinate $coordinate) { return sprintf('%s = new google.maps.LatLng(%s, %s, %s);' . PHP_EOL, $coordinate->getJavascriptVariable(), $coordinate->getLatitude(), $coordinate->getLongitude(), json_encode($coordinate->isNoWrap())); }