function let(ConstraintFactoryInterface $constraintFactory, FeatureValidatorInterface $boolConstraint, FeatureInterface $boolFeature)
 {
     $this->beConstructedWith($constraintFactory);
     $constraintFactory->getConstraint('bool')->willReturn($boolConstraint);
     $boolConstraint->validate(Argument::any(), Argument::any(), Argument::any())->willReturn(true);
     $boolFeature->getType()->willReturn('bool');
     $boolFeature->getValidationRules()->willReturn(null);
 }
示例#2
0
 function let(FeatureInterface $ltNumericFeature, FeatureInterface $lteNumericFeature, FeatureInterface $gtNumericFeature, FeatureInterface $gteNumericFeature, FeatureInterface $eqNumericFeature, FeatureInterface $neqNumericFeature, FeatureInterface $waNumericFeature)
 {
     $ltNumericFeature->getType()->willReturn('numeric');
     $ltNumericFeature->getValidationRules()->willReturn(json_encode(array('lt')));
     $lteNumericFeature->getType()->willReturn('numeric');
     $lteNumericFeature->getValidationRules()->willReturn(json_encode(array('lte')));
     $gtNumericFeature->getType()->willReturn('numeric');
     $gtNumericFeature->getValidationRules()->willReturn(json_encode(array('gt')));
     $gteNumericFeature->getType()->willReturn('numeric');
     $gteNumericFeature->getValidationRules()->willReturn(json_encode(array('gte')));
     $eqNumericFeature->getType()->willReturn('numeric');
     $eqNumericFeature->getValidationRules()->willReturn(json_encode(array('eq')));
     $neqNumericFeature->getType()->willReturn('numeric');
     $neqNumericFeature->getValidationRules()->willReturn(json_encode(array('neq')));
     $waNumericFeature->getType()->willReturn('numeric');
     $waNumericFeature->getValidationRules()->willReturn(null);
 }
 /**
  * {@inheritDoc}
  */
 public function validate(FeatureInterface $feature, $featureValue, $validatedValue)
 {
     $constraint = $this->constraintFactory->getConstraint($feature->getType());
     return $constraint->validate($feature, $featureValue, $validatedValue);
 }