Eloquent\Phony\Assertion\AssertionRenderer::renderNoInteraction PHP Method

renderNoInteraction() public method

Render a failed noInteraction() verification.
public renderNoInteraction ( Eloquent\Phony\Mock\Handle\Handle $handle, array $calls ) : string
$handle Eloquent\Phony\Mock\Handle\Handle The handle.
$calls array
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);
    }