From 4b64afa023f86ed9197ae108a52dc0717407dec4 Mon Sep 17 00:00:00 2001 From: Ken Guest Date: Tue, 31 May 2016 20:31:53 +0100 Subject: [PATCH] Preparing for new release. --- tests/WayFullTest.php | 64 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/WayFullTest.php diff --git a/tests/WayFullTest.php b/tests/WayFullTest.php new file mode 100644 index 0000000..4866d75 --- /dev/null +++ b/tests/WayFullTest.php @@ -0,0 +1,64 @@ + + * @license BSD http://www.opensource.org/licenses/bsd-license.php + * @version Release: @package_version@ + * @link WayTest.php + * @todo + */ + +$version = '@package_version@'; +if (strstr($version, 'package_version')) { + set_include_path(dirname(dirname(__FILE__)) . ':' . get_include_path()); +} + +require_once 'Services/OpenStreetMap.php'; + +require_once 'HTTP/Request2.php'; +require_once 'HTTP/Request2/Adapter/Mock.php'; + +/** + * Unit test class for manipulation of Services_OpenStreetMap_Way. + * + * @category Services + * @package Services_OpenStreetMap + * @subpackage UnitTesting + * @author Ken Guest + * @license BSD http://www.opensource.org/licenses/bsd-license.php + * @link WayTest.php + */ +class WayFullTest extends PHPUnit_Framework_TestCase +{ + + /** + * Test retrieving a way and some tags and attributes of it too. + * + * @return void + */ + public function testGetWayFull() + { + $id = 25978036; + + $mock = new HTTP_Request2_Adapter_Mock(); + $mock->addResponse(fopen(__DIR__ . '/responses/capabilities.xml', 'rb')); + $mock->addResponse(fopen(__DIR__ . '/responses/way.xml', 'rb')); + $mock->addResponse(fopen(__DIR__ . '/responses/way.xml', 'rb')); + + $config = array( + 'adapter' => $mock, + 'server' => 'http://api06.dev.openstreetmap.org/' + ); + $osm = new Services_OpenStreetMap($config); + $way = $osm->getWayFull($id, 1); + //var_dump($way); + $way = $osm->getWay($id); + //var_dump($way); + } +}