/** * Add validation rules for particular fields * * @return \Zend_Validate_Interface */ protected function _getValidationRulesBeforeSave() { /** @var $validator \Magento\Framework\Validator\DataObject */ $validator = $this->_validatorObject->create(); $this->validationRules->addUserInfoRules($validator); // Add validation rules for the password management fields if ($this->_willSavePassword()) { $this->validationRules->addPasswordRules($validator); if ($this->hasPasswordConfirmation()) { $this->validationRules->addPasswordConfirmationRule($validator, $this->getPasswordConfirmation()); } } return $validator; }
public function testAddPasswordConfirmationRule() { $this->validator->expects($this->once())->method('addRule')->willReturn($this->validator); $this->assertSame($this->validator, $this->rules->addPasswordConfirmationRule($this->validator, '')); }