public function setStubsFor($dataFlow, $functionDescriptions, $verifyCalls = false) { $mockFunctions = array(); $dataLog = $dataFlow->getStartLog(); while ($dataLog != null) { if (in_array($dataLog->functionSignature, $functionDescriptions)) { $nextFunctionLog = $dataLog->nextLog; while ($nextFunctionLog && $nextFunctionLog->functionSignature != $dataLog->functionSignature) { if (!in_array($nextFunctionLog->functionSignature, $functionDescriptions)) { $mockFunctions[] = $nextFunctionLog; $nextFunctionLog = $nextFunctionLog->getReturnLog()->nextLog; } else { $nextFunctionLog = $nextFunctionLog->nextLog; } } $dataLog = $nextFunctionLog->nextLog; } else { $dataLog = $dataLog->nextLog; } } MethodsAdvice::setVerifyCallOrder($verifyCalls); MethodsAdvice::enqueueStubs($mockFunctions); }