public function testInsertBeforeNonExistingElement() { $e1 = new HTML_QuickForm2_ElementImpl2('m1'); $e2 = new HTML_QuickForm2_ElementImpl2('m2'); $e3 = new HTML_QuickForm2_ElementImpl2('m3'); $c1 = new HTML_QuickForm2_ContainerImpl('n1'); $c1->appendChild($e1); $c2 = new HTML_QuickForm2_ContainerImpl('n2'); $c2->appendChild($c1); try { $c1->insertBefore($e2, $e3); } catch (HTML_QuickForm2_NotFoundException $e) { $this->assertEquals("Reference element with name '" . $e3->getName() . "' was not found", $e->getMessage()); try { $c2->insertBefore($e2, $e1); } catch (HTML_QuickForm2_NotFoundException $e) { $this->assertEquals("Reference element with name '" . $e1->getName() . "' was not found", $e->getMessage()); return; } } $this->fail('Expected HTML_QuickForm2_NotFoundException was not thrown'); }