Пример #1
0
 /**
  * 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());
     }
 }
Пример #2
0
 /**
  * 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()));
 }