/** * @param \Box\TestScribe\Execution\ExecutionResult $result * * @return void */ public function showExecutionResult(ExecutionResult $result) { $exception = $result->getException(); if ($exception) { $exceptionType = get_class($exception); $exceptionMsg = $exception->getMessage(); $resultMsg = "An exception ( {$exceptionType} ) is thrown.\n" . "Exception message ( {$exceptionMsg} )."; } else { $value = $result->getResultValue(); // @TODO (ryang 6/4/15) : don't show the value if the return value of the method is void. $valueStr = $this->valueFormatter->getReadableFormat($value); $resultMsg = "Result from this method execution is :\n" . "{$valueStr}\n" . "End of the result."; } $msg = "{$resultMsg}\n\n" . "Please verify this result and the interactions with the mocks are what you expect."; $this->output->writeln($msg); }
/** * @param \Box\TestScribe\MethodInfo\Method $method * @param array $arguments * * @return string * @throws \Box\TestScribe\Exception\TestScribeException */ private function getDetail(Method $method, array $arguments) { // @TODO (ryang 5/28/15) : more checking if the actual parameters // match the function prototype. $expectedParameters = $method->getParameters(); $maxExpectedCount = count($expectedParameters); $resultMsg = ''; foreach ($arguments as $index => $arg) { // convert the scalar value to its string representation. $stringRepresentation = $this->valueFormatter->getReadableFormat($arg); if ($index < $maxExpectedCount) { $expectedArg = $expectedParameters[$index]; $argumentName = $expectedArg->getName(); $paramMsg = " \${$argumentName} = {$stringRepresentation}"; } else { $paramMsg = "This argument of value ( {$stringRepresentation} ) is unexpected."; } $resultMsg .= "\n{$paramMsg}"; } return $resultMsg; }