private function newTestMethod($filePath, $className, ReflectionMethod $method, DocCommentParser $dcp) { $testMethod = new TestMethod(); $testMethod->setClassFilePath($filePath)->setClassName($className); $expectedInputArgumentNames = array_map(function ($parameter) { return $parameter->getName(); }, $method->getParameters()); $testMethod->setExpectedInputArgumentNames($expectedInputArgumentNames); $testMethod->setName($method->getName()); if ($dcp->hasOption('depends')) { $on = array_reverse($dcp->getArrayOption('depends')); foreach ($on as $offset => $methodName) { if (!empty($expectedInputArgumentNames)) { $argumentName = $expectedInputArgumentNames[count($expectedInputArgumentNames) - 1 - $offset]; } else { $argumentName = null; } $testMethod->setDependency($argumentName, $methodName); } } if ($dcp->hasOption('expectedException')) { $expectedException = $dcp->getOption('expectedException'); $testMethod->setExpectedException($expectedException); } return $testMethod; }