예제 #1
0
 /**
  * This method tests the merge method
  * of the hash map.
  *
  * @return void
  */
 public function testMerge()
 {
     // initialize a new HashMap
     $map = new HashMap();
     // initialize a new hash map and add some elements
     $mergeMap = new HashMap();
     $mergeMap->add(1, "test_merge_1");
     $mergeMap->add(3, "test_merge_3");
     // add some elements to the original hash map
     $map->add(1, "test_original_1");
     $map->add(2, "test_original_2");
     // merge the original map with the new one
     $map->merge($mergeMap);
     // check the merge result
     $this->assertEquals(3, $map->size());
     $this->assertEquals("test_original_1", $map->get(1));
 }