示例#1
0
 function it_should_validate_access(PlanInterface $plan, AttachedInterface $attachedFeature, FeatureValidatorInterface $validator)
 {
     $this->enable();
     $this->setPlan($plan);
     $af = $attachedFeature->getWrappedObject();
     $validator->validate($af->getFeature(), $af->getValue(), null)->shouldBeCalled();
     $this->isGranted('first_feature')->shouldReturn(true);
 }
示例#2
0
 /**
  * {@inheritDoc}
  */
 public function isGranted($featureName, $validatedValue = null)
 {
     if (!$this->isEnable()) {
         return true;
     }
     if (!$this->plan instanceof PlanInterface) {
         return false;
     }
     if (!$this->hasFeature($featureName)) {
         return false;
     }
     $attachedFeature = $this->attachedFeatures[$featureName];
     return $this->validator->validate($attachedFeature->getFeature(), $attachedFeature->getValue(), $validatedValue);
 }