| 1 |
|
<?php |
| 2 |
|
/** |
| 3 |
|
* Unit test class for Changeset 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 ChangesetTest.php |
| 14 |
|
*/ |
| 15 |
|
|
| 16 |
|
$version = '@package_version@'; |
| 17 |
|
if (strstr($version, 'package_version')) { |
| 18 |
|
set_include_path(dirname(dirname(__FILE__)) . ':' . get_include_path()); |
| 19 |
|
} |
| 20 |
|
|
| 21 |
|
require_once 'Services/Openstreetmap.php'; |
| 22 |
|
|
| 23 |
|
require_once 'HTTP/Request2.php'; |
| 24 |
|
require_once 'HTTP/Request2/Adapter/Mock.php'; |
| 25 |
|
require_once 'PHPUnit/Framework/TestCase.php'; |
| 26 |
|
|
| 27 |
|
|
| 28 |
|
/** |
| 29 |
|
* Unit test class for Changeset related functionality. |
| 30 |
|
* |
| 31 |
|
* @category Services |
| 32 |
|
* @package Services_Openstreetmap |
| 33 |
|
* @subpackage UnitTesting |
| 34 |
|
* @author Ken Guest <kguest@php.net> |
| 35 |
|
* @license BSD http://www.opensource.org/licenses/bsd-license.php |
| 36 |
|
* @link ChangesetTest.php |
| 37 |
|
*/ |
| 38 |
|
class ChangesetTest extends PHPUnit_Framework_TestCase |
| 39 |
|
{ |
| 40 |
|
public function testGetChangeset() |
| 41 |
|
{ |
| 42 |
1 |
$mock = new HTTP_Request2_Adapter_Mock(); |
| 43 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/capabilities.xml', 'rb')); |
| 44 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset.xml', 'rb')); |
| 45 |
|
|
| 46 |
1 |
$cId = 2217466; |
| 47 |
|
|
| 48 |
1 |
$config = array('adapter' => $mock, 'server' => 'http://api06.dev.openstreetmap.org'); |
| 49 |
1 |
$osm = new Services_Openstreetmap($config); |
| 50 |
1 |
$changeset = $osm->getChangeSet($cId); |
| 51 |
1 |
$this->assertEquals($cId, (int) $changeset->getId()); |
| 52 |
1 |
$this->assertEquals("2009-08-20T22:31:06Z", $changeset->getCreatedAt()); |
| 53 |
1 |
$this->assertEquals("2009-08-20T22:31:08Z", $changeset->getClosedAt()); |
| 54 |
1 |
$this->assertEquals(false, $changeset->isOpen()); |
| 55 |
1 |
$this->assertEquals("-8.2205445", $changeset->getMinLon()); |
| 56 |
1 |
$this->assertEquals("52.857758", $changeset->getMinLat()); |
| 57 |
1 |
$this->assertEquals("-8.2055278", $changeset->getMaxLon()); |
| 58 |
1 |
$this->assertEquals("52.8634333", $changeset->getMaxLat()); |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
/** |
| 62 |
|
* @expectedException Services_Openstreetmap_Exception |
| 63 |
|
* @expectedExceptionMessage Password must be set |
| 64 |
|
*/ |
| 65 |
|
public function testPasswordNotSet() |
| 66 |
|
{ |
| 67 |
1 |
$mock = new HTTP_Request2_Adapter_Mock(); |
| 68 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/capabilities.xml', 'rb')); |
| 69 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_id', 'rb')); |
| 70 |
|
$config = array( |
| 71 |
1 |
'adapter' => $mock, |
| 72 |
1 |
'server' => 'http://api06.dev.openstreetmap.org/', |
| 73 |
|
'user' => 'fred@example.com' |
| 74 |
1 |
); |
| 75 |
1 |
$osm = new Services_Openstreetmap($config); |
| 76 |
|
try { |
| 77 |
1 |
$changeset = $osm->createChangeset(); |
| 78 |
1 |
} catch (Services_Openstreetmap_Exception $e) { |
| 79 |
|
} |
| 80 |
1 |
$this->assertEquals(false, $changeset->isOpen()); |
| 81 |
1 |
$changeset->begin("Undo accidental highway change from residential to service"); |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
/** |
| 85 |
|
* @expectedException Services_Openstreetmap_Exception |
| 86 |
|
* @expectedExceptionMessage User must be set |
| 87 |
|
*/ |
| 88 |
|
public function testUserNotSet() |
| 89 |
|
{ |
| 90 |
1 |
$mock = new HTTP_Request2_Adapter_Mock(); |
| 91 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/capabilities.xml', 'rb')); |
| 92 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_id', 'rb')); |
| 93 |
|
$config = array( |
| 94 |
1 |
'adapter' => $mock, |
| 95 |
1 |
'server' => 'http://api06.dev.openstreetmap.org/', |
| 96 |
|
'password' => 'wilma4evah' |
| 97 |
1 |
); |
| 98 |
1 |
$osm = new Services_Openstreetmap($config); |
| 99 |
|
try { |
| 100 |
1 |
$changeset = $osm->createChangeset(); |
| 101 |
1 |
} catch (Services_Openstreetmap_Exception $e) { |
| 102 |
|
} |
| 103 |
1 |
$this->assertEquals(false, $changeset->isOpen()); |
| 104 |
1 |
$changeset->begin("Undo accidental highway change from residential to service"); |
| 105 |
|
|
| 106 |
|
} |
| 107 |
|
|
| 108 |
|
public function testChange() { |
| 109 |
1 |
$wayId = 30357328; |
| 110 |
1 |
$way2Id = 30357329; |
| 111 |
|
|
| 112 |
1 |
$mock = new HTTP_Request2_Adapter_Mock(); |
| 113 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/capabilities.xml', 'rb')); |
| 114 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/way_30357328_30357329.xml', 'rb')); |
| 115 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_id', 'rb')); |
| 116 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/diff_30357328_30357329.xml', 'rb')); |
| 117 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_closed', 'rb')); |
| 118 |
|
|
| 119 |
|
$config = array( |
| 120 |
1 |
'adapter' => $mock, |
| 121 |
1 |
'server' => 'http://api06.dev.openstreetmap.org/', |
| 122 |
|
'passwordfile' => __DIR__ . '/credentials' |
| 123 |
1 |
); |
| 124 |
1 |
$osm = new Services_Openstreetmap($config); |
| 125 |
|
try { |
| 126 |
1 |
$changeset = $osm->createChangeset(); |
| 127 |
1 |
} catch (Services_Openstreetmap_Exception $e) { |
| 128 |
|
} |
| 129 |
1 |
$this->assertEquals(false, $changeset->isOpen()); |
| 130 |
1 |
$ways = $osm->getWays($wayId, $way2Id); |
| 131 |
1 |
foreach($ways as $way) { |
| 132 |
1 |
$tags = $way->getTags(); |
| 133 |
1 |
if ($tags['highway'] == 'residential') { |
| 134 |
1 |
return; |
| 135 |
1 |
} |
| 136 |
|
} |
| 137 |
|
$this->assertEquals(2, count($ways)); |
| 138 |
|
$changeset->begin("Undo accidental highway change from residential to service"); |
| 139 |
|
foreach ($ways as $way) { |
| 140 |
|
$way->setTag('highway', 'residential'); |
| 141 |
|
$way->setTag('lit', 'yes'); |
| 142 |
|
$changeset->add($way); |
| 143 |
|
} |
| 144 |
|
$this->assertEquals(true, $changeset->isOpen()); |
| 145 |
|
$changeset->commit(); |
| 146 |
|
} |
| 147 |
|
|
| 148 |
|
/** |
| 149 |
|
* Test that an object can not be added to a closed changeset. |
| 150 |
|
* A changeset is closed after it has been committed. |
| 151 |
|
* |
| 152 |
|
* @expectedException Services_Openstreetmap_Exception |
| 153 |
|
* @expectedExceptionMessage Object added to closed changeset |
| 154 |
|
* |
| 155 |
|
* @return void |
| 156 |
|
*/ |
| 157 |
|
public function testObjectAddedToChangesetAfterCommit() { |
| 158 |
1 |
$wayId = 30357328; |
| 159 |
1 |
$way2Id = 30357329; |
| 160 |
|
|
| 161 |
1 |
$mock = new HTTP_Request2_Adapter_Mock(); |
| 162 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/capabilities.xml', 'rb')); |
| 163 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_id', 'rb')); |
| 164 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/way_30357328_30357329.xml', 'rb')); |
| 165 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/diff_30357328_30357329.xml', 'rb')); |
| 166 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_closed', 'rb')); |
| 167 |
|
|
| 168 |
|
$config = array( |
| 169 |
1 |
'adapter' => $mock, |
| 170 |
1 |
'server' => 'http://api06.dev.openstreetmap.org/', |
| 171 |
|
'passwordfile' => __DIR__ . '/credentials' |
| 172 |
1 |
); |
| 173 |
1 |
$osm = new Services_Openstreetmap($config); |
| 174 |
|
try { |
| 175 |
1 |
$changeset = $osm->createChangeset(); |
| 176 |
1 |
} catch (Services_Openstreetmap_Exception $e) { |
| 177 |
|
} |
| 178 |
1 |
$this->assertEquals(false, $changeset->isOpen()); |
| 179 |
1 |
$ways = $osm->getWays($wayId, $way2Id); |
| 180 |
1 |
$changeset->begin("Undo accidental highway change from residential to service"); |
| 181 |
1 |
foreach ($ways as $way) { |
| 182 |
|
$way->setTag('highway', 'residential'); |
| 183 |
|
$way->setTag('lit', 'yes'); |
| 184 |
|
$changeset->add($way); |
| 185 |
1 |
} |
| 186 |
1 |
$this->assertEquals(true, $changeset->isOpen()); |
| 187 |
1 |
$changeset->commit(); |
| 188 |
1 |
$lat = 52.8638729; |
| 189 |
1 |
$lon = -8.1983611; |
| 190 |
1 |
$node = $osm->createNode($lat, $lon, array( |
| 191 |
1 |
'building' => 'yes', |
| 192 |
1 |
'amenity' => 'vet') |
| 193 |
1 |
); |
| 194 |
1 |
$changeset->add($node); |
| 195 |
|
} |
| 196 |
|
|
| 197 |
|
/** |
| 198 |
|
* Test that the same object can not be added to the same changeset. |
| 199 |
|
* |
| 200 |
|
* @expectedException Services_Openstreetmap_Exception |
| 201 |
|
* @expectedExceptionMessage Object added to changeset already |
| 202 |
|
* |
| 203 |
|
* @return void |
| 204 |
|
*/ |
| 205 |
|
public function testSameObjectAddedToChangeset() { |
| 206 |
1 |
$wayId = 30357328; |
| 207 |
|
|
| 208 |
1 |
$mock = new HTTP_Request2_Adapter_Mock(); |
| 209 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/capabilities.xml', 'rb')); |
| 210 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/way_30357328.xml', 'rb')); |
| 211 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/way_30357328.xml', 'rb')); |
| 212 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_id', 'rb')); |
| 213 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/diff_30357328_30357329.xml', 'rb')); |
| 214 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_closed', 'rb')); |
| 215 |
|
|
| 216 |
|
$config = array( |
| 217 |
1 |
'adapter' => $mock, |
| 218 |
1 |
'server' => 'http://api06.dev.openstreetmap.org/', |
| 219 |
|
'passwordfile' => __DIR__ . '/credentials' |
| 220 |
1 |
); |
| 221 |
1 |
$osm = new Services_Openstreetmap($config); |
| 222 |
|
try { |
| 223 |
1 |
$changeset = $osm->createChangeset(); |
| 224 |
1 |
} catch (Services_Openstreetmap_Exception $e) { |
| 225 |
|
} |
| 226 |
1 |
$way = $osm->getWay($wayId); |
| 227 |
1 |
$way->setTag('highway', 'residential'); |
| 228 |
1 |
$way->setTag('lit', 'yes'); |
| 229 |
1 |
$this->assertNotEquals('' . $way, ''); |
| 230 |
1 |
$way2 = $osm->getWay($wayId); |
| 231 |
1 |
$way2->setTag('highway', 'residential'); |
| 232 |
1 |
$way2->setTag('lit', 'yes'); |
| 233 |
1 |
$this->assertNotEquals('' . $way2, ''); |
| 234 |
1 |
$this->assertEquals(false, $changeset->isOpen()); |
| 235 |
1 |
$changeset->begin("Undo accidental highway change from residential to service"); |
| 236 |
1 |
$changeset->add($way); |
| 237 |
1 |
$changeset->add($way2); |
| 238 |
|
} |
| 239 |
|
|
| 240 |
|
/** |
| 241 |
|
* Test deleting a node - including an 'accidental' second commit... |
| 242 |
|
* |
| 243 |
|
* @expectedException Services_Openstreetmap_Exception |
| 244 |
|
* @expectedExceptionMessage Attempt to commit a closed changeset |
| 245 |
|
*/ |
| 246 |
|
public function testDeleteNode() { |
| 247 |
1 |
$nodeID = 1436433375; |
| 248 |
|
|
| 249 |
1 |
$mock = new HTTP_Request2_Adapter_Mock(); |
| 250 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/capabilities.xml', 'rb')); |
| 251 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/node_1436433375.xml', 'rb')); |
| 252 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_id', 'rb')); |
| 253 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/diff_1436433375_deleted.xml', 'rb')); |
| 254 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_closed', 'rb')); |
| 255 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/410', 'rb')); |
| 256 |
|
|
| 257 |
|
$config = array( |
| 258 |
1 |
'adapter' => $mock, |
| 259 |
1 |
'server' => 'http://api06.dev.openstreetmap.org/', |
| 260 |
|
'passwordfile' => __DIR__ . '/credentials' |
| 261 |
1 |
); |
| 262 |
1 |
$osm = new Services_Openstreetmap($config); |
| 263 |
|
try { |
| 264 |
1 |
$changeset = $osm->createChangeset(); |
| 265 |
1 |
} catch (Services_Openstreetmap_Exception $e) { |
| 266 |
|
echo $e->getMessage(); |
| 267 |
|
return; |
| 268 |
|
} |
| 269 |
1 |
$node = $osm->getNode($nodeID); |
| 270 |
1 |
$this->assertTrue($node != false); |
| 271 |
1 |
$changeset->begin("Delete unrequired node."); |
| 272 |
1 |
$changeset->add($node->delete()); |
| 273 |
1 |
$this->assertEquals(true, $changeset->isOpen()); |
| 274 |
1 |
$changeset->commit(); |
| 275 |
1 |
$changeset->commit(); |
| 276 |
|
$node = $osm->getNode($nodeID); |
| 277 |
|
$this->assertFalse($node); |
| 278 |
|
} |
| 279 |
|
|
| 280 |
|
/** |
| 281 |
|
* @expectedException Services_Openstreetmap_Exception |
| 282 |
|
* @expectedExceptionMessage Error closing changeset |
| 283 |
|
*/ |
| 284 |
|
public function testDeleteNodeClosingError404() { |
| 285 |
1 |
$nodeID = 1436433375; |
| 286 |
|
|
| 287 |
1 |
$mock = new HTTP_Request2_Adapter_Mock(); |
| 288 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/capabilities.xml', 'rb')); |
| 289 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/node_1436433375.xml', 'rb')); |
| 290 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_id', 'rb')); |
| 291 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/diff_1436433375_deleted.xml', 'rb')); |
| 292 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/404', 'rb')); |
| 293 |
|
|
| 294 |
|
$config = array( |
| 295 |
1 |
'adapter' => $mock, |
| 296 |
1 |
'server' => 'http://api06.dev.openstreetmap.org/', |
| 297 |
|
'passwordfile' => __DIR__ . '/credentials' |
| 298 |
1 |
); |
| 299 |
1 |
$osm = new Services_Openstreetmap($config); |
| 300 |
|
try { |
| 301 |
1 |
$changeset = $osm->createChangeset(); |
| 302 |
1 |
} catch (Services_Openstreetmap_Exception $e) { |
| 303 |
|
echo $e->getMessage(); |
| 304 |
|
return; |
| 305 |
|
} |
| 306 |
1 |
$node = $osm->getNode($nodeID); |
| 307 |
1 |
$this->assertTrue($node != false); |
| 308 |
1 |
$changeset->begin("Delete unrequired node."); |
| 309 |
1 |
$changeset->add($node->delete()); |
| 310 |
1 |
$this->assertEquals(true, $changeset->isOpen()); |
| 311 |
1 |
$changeset->commit(); |
| 312 |
|
} |
| 313 |
|
|
| 314 |
|
/** |
| 315 |
|
* @expectedException Services_Openstreetmap_Exception |
| 316 |
|
* @xpectedExceptionMessage Error closing changeset |
| 317 |
|
*/ |
| 318 |
|
public function testDeleteNodeClosingError400() { |
| 319 |
1 |
$nodeID = 1436433375; |
| 320 |
|
|
| 321 |
1 |
$mock = new HTTP_Request2_Adapter_Mock(); |
| 322 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/capabilities.xml', 'rb')); |
| 323 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/node_1436433375.xml', 'rb')); |
| 324 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_id', 'rb')); |
| 325 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/diff_1436433375_deleted.xml', 'rb')); |
| 326 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/400', 'rb')); |
| 327 |
|
|
| 328 |
|
$config = array( |
| 329 |
1 |
'adapter' => $mock, |
| 330 |
1 |
'server' => 'http://api06.dev.openstreetmap.org/', |
| 331 |
|
'passwordfile' => __DIR__ . '/credentials' |
| 332 |
1 |
); |
| 333 |
1 |
$osm = new Services_Openstreetmap($config); |
| 334 |
|
try { |
| 335 |
1 |
$changeset = $osm->createChangeset(); |
| 336 |
1 |
} catch (Services_Openstreetmap_Exception $e) { |
| 337 |
|
echo $e->getMessage(); |
| 338 |
|
return; |
| 339 |
|
} |
| 340 |
1 |
$node = $osm->getNode($nodeID); |
| 341 |
1 |
$this->assertTrue($node != false); |
| 342 |
1 |
$changeset->begin("Delete unrequired node."); |
| 343 |
1 |
$changeset->add($node->delete()); |
| 344 |
1 |
$this->assertEquals(true, $changeset->isOpen()); |
| 345 |
1 |
$changeset->commit(); |
| 346 |
|
} |
| 347 |
|
|
| 348 |
|
/** |
| 349 |
|
* @expectedException Services_Openstreetmap_Exception |
| 350 |
|
* @expectedExceptionMessage Error posting changeset |
| 351 |
|
*/ |
| 352 |
|
public function testDeleteNodeDiffError400() { |
| 353 |
1 |
$nodeID = 1436433375; |
| 354 |
|
|
| 355 |
1 |
$mock = new HTTP_Request2_Adapter_Mock(); |
| 356 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/capabilities.xml', 'rb')); |
| 357 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/node_1436433375.xml', 'rb')); |
| 358 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_id', 'rb')); |
| 359 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/400', 'rb')); |
| 360 |
|
|
| 361 |
|
$config = array( |
| 362 |
1 |
'adapter' => $mock, |
| 363 |
1 |
'server' => 'http://api06.dev.openstreetmap.org/', |
| 364 |
|
'passwordfile' => __DIR__ . '/credentials' |
| 365 |
1 |
); |
| 366 |
1 |
$osm = new Services_Openstreetmap($config); |
| 367 |
|
try { |
| 368 |
1 |
$changeset = $osm->createChangeset(); |
| 369 |
1 |
} catch (Services_Openstreetmap_Exception $e) { |
| 370 |
|
echo $e->getMessage(); |
| 371 |
|
return; |
| 372 |
|
} |
| 373 |
1 |
$node = $osm->getNode($nodeID); |
| 374 |
1 |
$this->assertTrue($node != false); |
| 375 |
1 |
$changeset->begin("Delete unrequired node."); |
| 376 |
1 |
$changeset->add($node->delete()); |
| 377 |
1 |
$this->assertEquals(true, $changeset->isOpen()); |
| 378 |
1 |
$changeset->commit(); |
| 379 |
|
} |
| 380 |
|
|
| 381 |
|
public function testSaveNode() |
| 382 |
|
{ |
| 383 |
1 |
$mock = new HTTP_Request2_Adapter_Mock(); |
| 384 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/capabilities.xml', 'rb')); |
| 385 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_id', 'rb')); |
| 386 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/diff_create_node.xml', 'rb')); |
| 387 |
1 |
$mock->addResponse(fopen(__DIR__ . '/responses/changeset_closed', 'rb')); |
| 388 |
|
$config = array( |
| 389 |
1 |
'adapter' => $mock, |
| 390 |
1 |
'server' => 'http://api06.dev.openstreetmap.org/', |
| 391 |
1 |
'passwordfile' => __DIR__ . '/credentials', |
| 392 |
1 |
); |
| 393 |
1 |
$osm = new Services_Openstreetmap($config); |
| 394 |
1 |
$lat = 52.8638729; |
| 395 |
1 |
$lon = -8.1983611; |
| 396 |
1 |
$node = $osm->createNode($lat, $lon, array( |
| 397 |
1 |
'building' => 'yes', |
| 398 |
1 |
'amenity' => 'vet') |
| 399 |
1 |
); |
| 400 |
1 |
$this->assertEquals( |
| 401 |
1 |
$node->getTags(), |
| 402 |
|
array( |
| 403 |
1 |
'created_by' => 'Services_Openstreetmap', |
| 404 |
1 |
'building' => 'yes', |
| 405 |
1 |
'amenity' => 'vet', |
| 406 |
|
) |
| 407 |
1 |
); |
| 408 |
1 |
$this->assertEquals($lat, $node->getlat()); |
| 409 |
1 |
$this->assertEquals($lon, $node->getlon()); |
| 410 |
1 |
$node->setTag('amenity', 'veterinary')->setTag('name', 'O\'Kennedy'); |
| 411 |
1 |
$this->assertEquals( |
| 412 |
1 |
$node->getTags(), |
| 413 |
|
array( |
| 414 |
1 |
'created_by' => 'Services_Openstreetmap', |
| 415 |
1 |
'building' => 'yes', |
| 416 |
1 |
'amenity' => 'veterinary', |
| 417 |
|
'name' => 'O\'Kennedy' |
| 418 |
1 |
) |
| 419 |
1 |
); |
| 420 |
1 |
$this->assertEquals(-1, $node->getId()); |
| 421 |
|
|
| 422 |
1 |
$changeset = $osm->createChangeset(); |
| 423 |
1 |
$changeset->begin("Add O'Kennedy vets in Nenagh"); |
| 424 |
1 |
$changeset->add($node); |
| 425 |
1 |
$changeset->commit(); |
| 426 |
1 |
$this->assertEquals($node->getId(), 1448499623); |
| 427 |
|
} |
| 428 |
|
} |
| 429 |
|
// vim:set et ts=4 sw=4: |
| 430 |
|
?> |