public function testAddPolyCoordinateWithValidValue() { $this->markerShape->resetCoordinates(); $this->markerShape->setType('poly'); $this->markerShape->addPolyCoordinate(1, 2); $this->markerShape->addPolyCoordinate(3, 4); $this->assertSame(array(1, 2, 3, 4), $this->markerShape->getCoordinates()); }
/** * Renders a marker shape. * * @param \Ivory\GoogleMap\Overlays\MarkerShape $markerShape The marker shape. * * @return string The JS output. */ public function render(MarkerShape $markerShape) { return sprintf('%s = new google.maps.MarkerShape(%s);' . PHP_EOL, $markerShape->getJavascriptVariable(), json_encode(array('type' => $markerShape->getType(), 'coords' => $markerShape->getCoordinates()))); }