public function testBug10754() { $mockFrom = $this->getMock('HTML_QuickForm2_Element', array('getType', 'getValue', 'setValue', '__toString')); $mockFrom->expects($this->once())->method('getValue')->will($this->returnValue('00080002310000114151')); $mockTo = $this->getMock('HTML_QuickForm2_Element', array('getType', 'getValue', 'setValue', '__toString')); $mockTo->expects($this->once())->method('getValue')->will($this->returnValue('00080002310000114152')); $ruleAccounts = new HTML_QuickForm2_Rule_Compare($mockFrom, 'You cannot transfer money to and from same account', array('!=', $mockTo)); $this->assertTrue($ruleAccounts->validate()); }
public function testValidationTriggers() { $foo = $this->getMock('HTML_QuickForm2_Element', array('getType', 'getRawValue', 'setValue', '__toString'), array('foo', array('id' => 'foo'))); $bar = $this->getMock('HTML_QuickForm2_Element', array('getType', 'getRawValue', 'setValue', '__toString'), array('bar', array('id' => 'bar'))); $compare = new HTML_QuickForm2_Rule_Compare($foo, '...', $bar); $this->assertContains('["foo","bar"]', $compare->getJavascript()); }