/** * Validate customer entity * * @param Mage_Customer_Model_Customer $customer * @throws Magento_Validator_Exception when validation failed */ protected function _validate($customer) { $validator = $this->_validatorFactory->createValidator('customer', 'save'); if (!$validator->isValid($customer)) { throw new Magento_Validator_Exception($validator->getMessages()); } }
/** * Test createValidatorBuilder call */ public function testCreateValidator() { $this->_validatorConfig->expects($this->once())->method('createValidator')->with('test', 'class', array())->will($this->returnValue(new Magento_Validator())); $factory = new Mage_Core_Model_Validator_Factory($this->_objectManager, $this->_config, $this->_translateAdapter); $this->assertInstanceOf('Magento_Validator', $factory->createValidator('test', 'class', array())); }