/** * Render a failed noInteraction() verification. * * @param Handle $handle The handle. * @param array<Call> $calls The calls. * * @return string The rendered failure message. */ public function renderNoInteraction(Handle $handle, array $calls) { $class = $handle->clazz(); if ($parentClass = $class->getParentClass()) { $class = $parentClass; } $atoms = explode('\\', $class->getName()); $renderedHandle = array_pop($atoms); if ($handle instanceof InstanceHandle) { $label = $handle->label(); if (null !== $label) { $renderedHandle .= '[' . $label . ']'; } } else { $renderedHandle .= '[static]'; } usort($calls, 'Eloquent\\Phony\\Call\\CallData::compareSequential'); $renderedCalls = array(); foreach ($calls as $index => $call) { $renderedArguments = array(); foreach ($call->arguments()->all() as $argument) { $renderedArguments[] = $this->exporter->export($argument); } $renderedCalls[] = ' ' . $this->fail . ' ' . $this->exporter->exportCallable($call->callback()) . '(' . implode(', ', $renderedArguments) . ')'; } return $this->reset . 'Expected no interaction with ' . $this->bold . $renderedHandle . $this->reset . '. Calls:' . PHP_EOL . implode(PHP_EOL, $renderedCalls); }