public function testCannotAppendWithOr_() { $mockNode = $this->getMock('HTML_QuickForm2_Node', $this->nodeAbstractMethods); $required = new HTML_QuickForm2_Rule_Required($mockNode, 'element is required'); try { $required->or_($this->getMock('HTML_QuickForm2_Rule', array('validateOwner'), array($mockNode, 'some message'))); } catch (HTML_QuickForm2_Exception $e) { $this->assertRegexp('/Cannot add a rule to "required" rule/', $e->getMessage()); return; } $this->fail('Expected HTML_QuickForm2_Exception was not thrown'); }
public function testCannotAppendWithOr_() { $mockNode = $this->getMock('HTML_QuickForm2_Node', array('updateValue', 'getId', 'getName', 'getType', 'getValue', 'setId', 'setName', 'setValue', '__toString')); $required = new HTML_QuickForm2_Rule_Required($mockNode, 'element is required'); try { $required->or_($this->getMock('HTML_QuickForm2_Rule', array('checkValue'), array($mockNode, 'some message'))); } catch (HTML_QuickForm2_Exception $e) { $this->assertRegexp('/Cannot add a rule to "required" rule/', $e->getMessage()); return; } $this->fail('Expected HTML_QuickForm2_Exception was not thrown'); }