示例#1
0
 /**
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  *
  * @return \Box\TestScribe\Config\ConfigParams
  * @throws \Box\TestScribe\Exception\TestScribeException
  */
 public function getInputParams(InputInterface $input)
 {
     $originalInSourceFile = (string) $input->getArgument(CmdOption::SOURCE_FILE_NAME_KEY);
     // Always use the absolute path. This is needed when checking
     // if a call is from the class under test.
     $inSourceFile = $this->fileFunctionWrapper->realpath($originalInSourceFile);
     $inClassName = $this->classExtractor->getClassName($inSourceFile);
     $inPhpClassName = new PhpClassName($inClassName);
     $methodName = $this->methodNameGetter->getTestMethodName($input, $inClassName);
     $msg = "Testing the method ( {$methodName} ) of the class ( {$inClassName} ).";
     $this->output->writeln($msg);
     $inputParams = new ConfigParams($inSourceFile, $inPhpClassName, $methodName);
     return $inputParams;
 }
示例#2
0
 /**
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param string $testFileRoot
  * @param string $inSourceFile
  *
  * @return string
  * @throws \Box\TestScribe\Exception\TestScribeException
  */
 public function getSourceFileRoot(InputInterface $input, $testFileRoot, $inSourceFile)
 {
     $originalSourceFileRoot = (string) $input->getOption(CmdOption::SOURCE_ROOT_OPTION_NAME);
     if ($originalSourceFileRoot === '') {
         // Infer source file root.
         $sourceFileRoot = $this->getSourceRoot($testFileRoot, $inSourceFile);
     } else {
         $sourceFileRoot = $this->fileFunctionWrapper->realpath($originalSourceFileRoot);
     }
     return $sourceFileRoot;
 }