Permalink
Browse files

Test setting multiple tags to a way (or any other object)

  • Loading branch information...
Ken
Ken committed May 30, 2012
1 parent 9d38a7a commit 8898909eaefca7f32afb9c14749ad915693d8b11
Showing with 34 additions and 0 deletions.
  1. +34 −0 tests/WayTest.php
View
@@ -65,6 +65,40 @@ public function testGetWay()
$this->assertEquals($way->getNodes(), array('283393706','283393707'));
}
+ /**
+ * Test setting multiple tags to a way (or any other object)
+ */
+ public function testGetAddMultipleTagsToWay()
+ {
+ $id = 25978036;
+
+ $mock = new HTTP_Request2_Adapter_Mock();
+ $mock->addResponse(fopen(__DIR__ . '/responses/capabilities.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->getWay($id);
+
+ $getTags = $way->getTags();
+ $this->assertEquals($getTags['highway'], 'service');
+ $this->assertEquals($getTags, array ('highway' => 'service'));
+
+ $way->setTags(array( 'service' => 'driveway' , 'surface' => 'gravel') ) ;
+ $this->assertEquals(
+ $way->getTags(),
+ array (
+ 'highway' => 'service',
+ 'service' => 'driveway',
+ 'surface' => 'gravel',
+ )
+ );
+
+ }
+
/**
* Test the isClosed method against a closed way.
*

0 comments on commit 8898909

Please sign in to comment.