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