/** * Call magic method * * Maps the method call to a validator name and adds that validator to the * Builder object. * * @param string Base name of the validator * @param array Constructor arguments * @returns Zend_Validate_Builder_FluentAdder * @throws none */ public function __call($name, $args) { // Append the returned id to our list $this->_rowIds[] = $this->_builder->add($this->_factory->create($name, $args), $this->_fieldSpec, $this->_flags); return $this; }
public function testValdationRaisesMessages() { $mockEm = $this->getMock('Zend_Validate_Builder_ErrorManager'); $mockEm->expects($this->exactly(7))->method('clear'); $mockEm->expects($this->exactly(4))->method('raise'); $mockVal1 = $this->getMock('Zend_Validate_Abstract'); $mockVal1->expects($this->exactly(7))->method('isValid')->will($this->onConsecutiveCalls($this->returnValue(false), $this->returnValue(true), $this->returnValue(false), $this->returnValue(true), $this->returnValue(false), $this->returnValue(true), $this->returnValue(false))); $zvb = new Zend_Validate_Builder(); $zvb->setErrorManager($mockEm); $zvb->add($mockVal1, 'test1'); $zvb->add($mockVal1, 'test2'); $zvb->add($mockVal1, array('test3', 'test4')); $zvb->add($mockVal1, '/test[56]/', Zend_Validate_Builder::PATTERN); $zvb->add($mockVal1, array('_test', 'test_'), Zend_Validate_Builder::PASS_GROUP); $valid = $zvb->isValid($this->_testSet); $this->assertFalse($valid); }