/** * @param ExampleNode $example * @param Specification $context * @param MatcherManager $matchers * @param CollaboratorManager $collaborators */ public function prepare(ExampleNode $example, Specification $context, MatcherManager $matchers, CollaboratorManager $collaborators) { $subjectFactory = new Wrapper($matchers, $this->presenter, $this->dispatcher, $example, $this->accessInspector); $subject = $subjectFactory->wrap(null); $subject->beAnInstanceOf($example->getSpecification()->getResource()->getSrcClassname()); $context->setSpecificationSubject($subject); }
/** * @param ExampleNode $example * @param Specification $context * @param MatcherManager $matchers * @param CollaboratorManager $collaborators */ public function prepare(ExampleNode $example, Specification $context, MatcherManager $matchers, CollaboratorManager $collaborators) { $matchers->replace($this->defaultMatchers); if (!$context instanceof MatchersProvider) { return; } foreach ($context->getMatchers() as $name => $matcher) { if ($matcher instanceof Matcher) { $matchers->add($matcher); } else { $matchers->add(new CallbackMatcher($name, $matcher, $this->presenter)); } } }