/** * Construct a new spy. * * @param callable|null $callback The callback, or null to create an anonymous spy. * @param string|null $label The label. * @param CallFactory $callFactory The call factory to use. * @param Invoker $invoker The invoker to use. * @param GeneratorSpyFactory $generatorSpyFactory The generator spy factory to use. * @param IterableSpyFactory $iterableSpyFactory The iterable spy factory to use. */ public function __construct($callback, $label, CallFactory $callFactory, Invoker $invoker, GeneratorSpyFactory $generatorSpyFactory, IterableSpyFactory $iterableSpyFactory) { parent::__construct($callback, $label); $this->callFactory = $callFactory; $this->invoker = $invoker; $this->generatorSpyFactory = $generatorSpyFactory; $this->iterableSpyFactory = $iterableSpyFactory; $this->calls = array(); $this->useGeneratorSpies = true; $this->useIterableSpies = false; $this->isRecording = true; }
/** * Construct a new wrapped method. * * @param ReflectionMethod $method The method. * @param Handle $handle The handle. */ public function __construct(ReflectionMethod $method, Handle $handle) { $this->method = $method; $this->handle = $handle; $this->name = $method->getName(); if ($handle instanceof StaticHandle) { $this->mock = null; $callback = array($method->getDeclaringClass()->getName(), $this->name); } else { $this->mock = $handle->get(); $callback = array($this->mock, $this->name); } parent::__construct($callback, null); }
/** * Construct a new wrapped magic method. * * @param string $name The name. * @param ReflectionMethod $callMagicMethod The _callMagic() method. * @param bool $isUncallable True if the underlying magic method is uncallable. * @param Handle $handle The handle. */ public function __construct($name, ReflectionMethod $callMagicMethod, $isUncallable, Handle $handle) { $this->name = $name; $this->callMagicMethod = $callMagicMethod; $this->isUncallable = $isUncallable; $this->handle = $handle; if ($callMagicMethod->isStatic()) { $this->mock = null; $callback = array($callMagicMethod->getDeclaringClass()->getName(), '__callStatic'); } else { $this->mock = $handle->get(); $callback = array($this->mock, '__call'); } parent::__construct($callback, null); }
/** * Construct a new stub data instance. * * @param callable|null $callback The callback, or null to create an anonymous stub. * @param mixed $self The self value. * @param string|null $label The label. * @param callable $defaultAnswerCallback The callback to use when creating a default answer. * @param MatcherFactory $matcherFactory The matcher factory to use. * @param MatcherVerifier $matcherVerifier The matcher verifier to use. * @param Invoker $invoker The invoker to use. * @param InvocableInspector $invocableInspector The invocable inspector to use. * @param EmptyValueFactory $emptyValueFactory The empty value factory to use. * @param GeneratorAnswerBuilderFactory $generatorAnswerBuilderFactory The generator answer builder factory to use. */ public function __construct($callback, $self, $label, $defaultAnswerCallback, MatcherFactory $matcherFactory, MatcherVerifier $matcherVerifier, Invoker $invoker, InvocableInspector $invocableInspector, EmptyValueFactory $emptyValueFactory, GeneratorAnswerBuilderFactory $generatorAnswerBuilderFactory) { parent::__construct($callback, $label); if (empty($self)) { $self = $this->callback; } $this->defaultAnswerCallback = $defaultAnswerCallback; $this->matcherFactory = $matcherFactory; $this->matcherVerifier = $matcherVerifier; $this->invoker = $invoker; $this->invocableInspector = $invocableInspector; $this->emptyValueFactory = $emptyValueFactory; $this->generatorAnswerBuilderFactory = $generatorAnswerBuilderFactory; $this->secondaryRequests = array(); $this->answers = array(); $this->rules = array(); $this->setSelf($self); }