Skip to content

Commit 4b64afa

Browse files
committed
Preparing for new release.
1 parent 297b114 commit 4b64afa

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

tests/WayFullTest.php

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/**
3+
* Unit test class for Way related functionality.
4+
*
5+
* PHP Version 5
6+
*
7+
* @category Services
8+
* @package Services_OpenStreetMap
9+
* @subpackage UnitTesting
10+
* @author Ken Guest <kguest@php.net>
11+
* @license BSD http://www.opensource.org/licenses/bsd-license.php
12+
* @version Release: @package_version@
13+
* @link WayTest.php
14+
* @todo
15+
*/
16+
17+
$version = '@package_version@';
18+
if (strstr($version, 'package_version')) {
19+
set_include_path(dirname(dirname(__FILE__)) . ':' . get_include_path());
20+
}
21+
22+
require_once 'Services/OpenStreetMap.php';
23+
24+
require_once 'HTTP/Request2.php';
25+
require_once 'HTTP/Request2/Adapter/Mock.php';
26+
27+
/**
28+
* Unit test class for manipulation of Services_OpenStreetMap_Way.
29+
*
30+
* @category Services
31+
* @package Services_OpenStreetMap
32+
* @subpackage UnitTesting
33+
* @author Ken Guest <kguest@php.net>
34+
* @license BSD http://www.opensource.org/licenses/bsd-license.php
35+
* @link WayTest.php
36+
*/
37+
class WayFullTest extends PHPUnit_Framework_TestCase
38+
{
39+
40+
/**
41+
* Test retrieving a way and some tags and attributes of it too.
42+
*
43+
* @return void
44+
*/
45+
public function testGetWayFull()
46+
{
47+
$id = 25978036;
48+
49+
$mock = new HTTP_Request2_Adapter_Mock();
50+
$mock->addResponse(fopen(__DIR__ . '/responses/capabilities.xml', 'rb'));
51+
$mock->addResponse(fopen(__DIR__ . '/responses/way.xml', 'rb'));
52+
$mock->addResponse(fopen(__DIR__ . '/responses/way.xml', 'rb'));
53+
54+
$config = array(
55+
'adapter' => $mock,
56+
'server' => 'http://api06.dev.openstreetmap.org/'
57+
);
58+
$osm = new Services_OpenStreetMap($config);
59+
$way = $osm->getWayFull($id, 1);
60+
//var_dump($way);
61+
$way = $osm->getWay($id);
62+
//var_dump($way);
63+
}
64+
}

0 commit comments

Comments
 (0)