/** * Checks the render method */ public function testRender() { $mapTest = new Map(); $polylineTest = new Polyline(); $polylineTest->setCoordinates(array(new Coordinate(1.1, 2.1, true), new Coordinate(3.1, 4.2, true), new Coordinate(7.4, 12.6, true))); $this->assertEquals(self::$polylineHelper->render($polylineTest, $mapTest), 'var ' . $polylineTest->getJavascriptVariable() . ' = new google.maps.Polyline({"map":' . $mapTest->getJavascriptVariable() . ',"path":[new google.maps.LatLng(1.1, 2.1, true),new google.maps.LatLng(3.1, 4.2, true),new google.maps.LatLng(7.4, 12.6, true)]});' . PHP_EOL); $polylineTest->setOptions(array('option1' => 'value1', 'option2' => 'value2')); $this->assertEquals(self::$polylineHelper->render($polylineTest, $mapTest), 'var ' . $polylineTest->getJavascriptVariable() . ' = new google.maps.Polyline({"map":' . $mapTest->getJavascriptVariable() . ',"path":[new google.maps.LatLng(1.1, 2.1, true),new google.maps.LatLng(3.1, 4.2, true),new google.maps.LatLng(7.4, 12.6, true)],"option1":"value1","option2":"value2"});' . PHP_EOL); }
/** * Checks the render polylines method */ public function testRenderPolylines() { $mapTest = new Model\Map(); $polylineTest = new Overlays\Polyline(); $polylineTest->setCoordinates(array(new Base\Coordinate(1.1, 2.1, true), new Base\Coordinate(3.1, 4.1, true))); $mapTest->addPolyline($polylineTest); $this->assertEquals(self::$mapHelper->renderPolylines($mapTest), 'var ' . $polylineTest->getJavascriptVariable() . ' = new google.maps.Polyline({"map":' . $mapTest->getJavascriptVariable() . ',"path":[new google.maps.LatLng(1.1, 2.1, true),new google.maps.LatLng(3.1, 4.1, true)]});' . PHP_EOL); }