/**
  * @param null|string $value
  * @param null|string $label
  * @param null|string $inputValidation
  * @param bool|array  $expectedOutput
  * @dataProvider validateInputRuleDataProvider
  */
 public function testValidateInputRule($value, $label, $inputValidation, $expectedOutput)
 {
     $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
     $this->_attributeMock->expects($this->any())->method('getStoreLabel')->will($this->returnValue($label));
     $this->_attributeMock->expects($this->any())->method('getValidationRules')->will($this->returnValue(array(new ValidationRule($helper->getObject('\\Magento\\Customer\\Service\\V1\\Data\\Eav\\ValidationRuleBuilder')->populateWithArray(array('name' => 'input_validation', 'value' => $inputValidation))))));
     $this->assertEquals($expectedOutput, $this->_model->validateInputRule($value));
 }
Example #2
0
 /**
  * @param null|string $value
  * @param null|string $label
  * @param null|string $inputValidation
  * @param bool|array  $expectedOutput
  * @dataProvider validateInputRuleDataProvider
  */
 public function testValidateInputRule($value, $label, $inputValidation, $expectedOutput)
 {
     $validationRule = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\ValidationRuleInterface')->disableOriginalConstructor()->setMethods(['getName', 'getValue'])->getMockForAbstractClass();
     $validationRule->expects($this->any())->method('getName')->will($this->returnValue('input_validation'));
     $validationRule->expects($this->any())->method('getValue')->will($this->returnValue($inputValidation));
     $this->_attributeMock->expects($this->any())->method('getStoreLabel')->will($this->returnValue($label));
     $this->_attributeMock->expects($this->any())->method('getValidationRules')->will($this->returnValue([$validationRule]));
     $this->assertEquals($expectedOutput, $this->_model->validateInputRule($value));
 }
Example #3
0
 /**
  * @param null|string $value
  * @param null|string $label
  * @param null|string $inputValidation
  * @param bool|array  $expectedOutput
  * @dataProvider validateInputRuleDataProvider
  */
 public function testValidateInputRule($value, $label, $inputValidation, $expectedOutput)
 {
     $this->_attributeMock->expects($this->any())->method('getStoreLabel')->will($this->returnValue($label));
     $this->_attributeMock->expects($this->any())->method('getValidationRules')->will($this->returnValue(array('input_validation' => $inputValidation)));
     $this->assertEquals($expectedOutput, $this->_model->validateInputRule($value));
 }