/** * Handle intercepted calls made to the mock class instance. * * @param \Box\TestScribe\Mock\MockClass $mockClass * @param string $methodName * @param array $arguments * * @return mixed|void * @throws \Box\TestScribe\Exception\TestScribeException * @throw \RuntimeException */ public function invokeInterceptedCall(MockClass $mockClass, $methodName, $arguments) { $this->output->writeStartSeparator(); $phpClassObj = $mockClass->getPhpClass(); $methodObj = $this->methodHelper->createFromMethodName($phpClassObj, $methodName); $mockObjName = $mockClass->getMockObjectName(); $this->mockClassServiceCallInfo->showCallInfo($mockObjName, $methodObj, $arguments); $returnValue = $this->mockClassServiceInfoSaver->gatherAndSaveCallInfo($mockClass, $methodName, $arguments); $this->output->writeEndSeparator(); return $returnValue; }
/** * Handle intercepted calls made to the mock class instance. * * @param \Box\TestScribe\Mock\MockClass $mockClass * @param string $methodName * @param array $arguments * * @return mixed|void * @throws \Box\TestScribe\Exception\TestScribeException * @throw \RuntimeException */ public function gatherAndSaveCallInfo(MockClass $mockClass, $methodName, $arguments) { $phpClass = $mockClass->getPhpClass(); $className = $mockClass->getClassNameBeingMocked(); $methodObj = $this->methodHelper->createFromMethodName($phpClass, $methodName); $retPHPDocType = $methodObj->getReturnType(); $value = $this->inputValueGetter->get($retPHPDocType, 'return value', $className, $methodName, ''); $mockClass->saveInvocationInformation($methodObj, $arguments, $value); $returnValue = $value->getValue(); return $returnValue; }