/** * Proxies to the underlying Builder class. * * @see Zend_Validate_Interface::isValid() */ public function isValid($data) { return $this->_builder->isValid($data); }
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); }