public function testDuplicateIdHandling() { $e1 = new HTML_QuickForm2_ElementImpl2('dup1', array('id' => 'dup')); $e2 = new HTML_QuickForm2_ElementImpl2('dup2', array('id' => 'dup')); $c1 = new HTML_QuickForm2_ContainerImpl('dupContainer1'); $c2 = new HTML_QuickForm2_ContainerImpl('dupContainer2'); $c1->appendChild($e1); $c1->appendChild($e2); $this->assertEquals(2, count($c1), 'Element count is incorrect'); $c1->removeChild($e1); $this->assertEquals(1, count($c1), 'Element count is incorrect'); $this->assertSame($e2, $c1->getElementById('dup')); $c2->appendChild($e1); $c2->appendChild($e2); $c2->removeChild($e2); $this->assertEquals(1, count($c2), 'Element count is incorrect'); $this->assertSame($e1, $c2->getElementById('dup')); }