コード例 #1
0
 public function testGetValidationRules()
 {
     $expectsRules = ['required-entry' => true, 'validate-number' => true];
     $this->validationRule->expects($this->atLeastOnce())->method('getName')->willReturn('input_validation');
     $this->validationRule->expects($this->atLeastOnce())->method('getValue')->willReturn('numeric');
     $this->assertEquals($expectsRules, $this->validationRules->getValidationRules(true, [$this->validationRule, new \Magento\Framework\DataObject()]));
 }
コード例 #2
0
 /**
  * Return rule value
  *
  * @param ValidationRuleInterface $rule
  * @return bool|string
  */
 protected function getRuleValue(ValidationRuleInterface $rule)
 {
     return $rule->getName() != 'input_validation' ? $rule->getValue() : true;
 }