public apply ( Phpro\SoapClient\CodeGenerator\Context\ContextInterface $context ) | ||
$context | Phpro\SoapClient\CodeGenerator\Context\ContextInterface |
/** * @param RuleInterface $rule * @param ContextInterface $context */ private function applyRule(RuleInterface $rule, ContextInterface $context) { if (!$rule->appliesToContext($context)) { return; } $rule->apply($context); }
function it_can_apply_to_multiple_other_rules(RuleInterface $rule1, RuleInterface $rule2, ContextInterface $context) { $rule1->appliesToContext($context)->willReturn(false); $rule1->apply($context)->shouldNotBeCalled(); $rule2->appliesToContext($context)->willReturn(true); $rule2->apply($context)->shouldBeCalled(); $this->apply($context); }
function it_appies_subrule_when_applied(RuleInterface $subRule, ContextInterface $context) { $subRule->apply($context)->shouldBeCalled(); $this->apply($context); }
function it_applies_the_default_rule_to_unknown_types(RuleInterface $defaultRule, TypeContext $context) { $context->getType()->willReturn(new Type('MyNamespace', 'UnknownType', [])); $defaultRule->apply($context)->shouldBeCalled(); $this->apply($context); }
function it_can_skip_rules(RuleInterface $rule, ContextInterface $context) { $rule->appliesToContext($context)->willReturn(false); $rule->apply($context)->shouldNotBeCalled(); $this->applyRules($context); }
/** * @param ContextInterface $context */ public function apply(ContextInterface $context) { $this->subRule->apply($context); }