function CallCenter::createUnexpectedCallException
Parameters
ObjectProphecy<object> $prophecy:
string $methodName:
array<mixed> $arguments:
Return value
1 call to CallCenter::createUnexpectedCallException()
- CallCenter::checkUnexpectedCalls in vendor/
phpspec/ prophecy/ src/ Prophecy/ Call/ CallCenter.php
File
-
vendor/
phpspec/ prophecy/ src/ Prophecy/ Call/ CallCenter.php, line 172
Class
- CallCenter
- Calls receiver & manager.
Namespace
Prophecy\CallCode
private function createUnexpectedCallException(ObjectProphecy $prophecy, $methodName, array $arguments) {
$classname = get_class($prophecy->reveal());
$indentationLength = 8;
// looks good
$argstring = implode(",\n", $this->indentArguments(array_map(array(
$this->util,
'stringify',
), $arguments), $indentationLength));
$expected = array();
foreach (array_merge(...array_values($prophecy->getMethodProphecies())) as $methodProphecy) {
$expected[] = sprintf(" - %s(\n" . "%s\n" . " )", $methodProphecy->getMethodName(), implode(",\n", $this->indentArguments(array_map('strval', $methodProphecy->getArgumentsWildcard()
->getTokens()), $indentationLength)));
}
return new UnexpectedCallException(sprintf("Unexpected method call on %s:\n" . " - %s(\n" . "%s\n" . " )\n" . "expected calls were:\n" . "%s", $classname, $methodName, $argstring, implode("\n", $expected)), $prophecy, $methodName, $arguments);
}