/** * @return array|Call[] */ public function calls() { return array_filter($this->stub->has()->calls(), function (Call $call) { foreach ($this->arguments as $i => $argument) { $callArguments = $call->arguments(); if (!array_key_exists($i, $callArguments) || !$argument->accepts(new ExactArgument($call->argument($i)))) { return false; } } return true; }); }
/** * @param Stub $stub * @return string */ public function printStub(Stub $stub) { $class = $stub->className(); $method = $stub->methodName(); $calls = $stub->has()->calls(); if (!$calls) { return "No calls recorded for [{$class}::{$method}()]"; } return "History of [{$class}::{$method}()]\n " . $this->printCalls($method, $calls); }