/** * @param \Symfony\Component\Console\Input\InputInterface $input * * @return \Box\TestScribe\Config\GlobalComputedConfig */ public function config(InputInterface $input) { // Need to load the bootstrap file first // This is needed to set up class auto loader so // that the call to select methods can load the target // class correctly. $this->configHelper->loadBootstrapFile($input); $inputParams = $this->inputConfig->getInputParams($input); $inSourceFile = $inputParams->getSourceFile(); $options = $this->optionsConfig->getOptions($input, $inSourceFile); $outputParams = $this->outputConfig->getOutputParams($options, $inputParams); $inMethodObj = $this->paramHelper->getMethodObjFromParamObj($inputParams); $config = new GlobalComputedConfig($inputParams, $inMethodObj, $options, $outputParams); return $config; }
/** * @param \Symfony\Component\Console\Input\InputInterface $input * @param string $inSourceFile * * @return \Box\TestScribe\Config\Options */ public function getOptions(InputInterface $input, $inSourceFile) { $configFilePath = $this->configHelper->getConfigFilePath($input); $generateSpec = false; $testBaseClassName = self::DEFAULT_TEST_BASE_CLASS_NAME; if ($configFilePath) { $data = $this->yamlUtil->loadYamlFile($configFilePath); $generateSpec = ArrayUtil::lookupBoolValue(self::GENERATE_SPEC_KEY, $data, false); $testBaseClassName = ArrayUtil::lookupStringValue(self::TEST_BASE_CLASS_NAME_KEY, $data, self::DEFAULT_TEST_BASE_CLASS_NAME); } $overwriteExistingDestinationFile = $input->getOption(CmdOption::OVERWRITE_EXISTING_DESTINATION_FILE_OPTION); $testFileRoot = $this->configHelper->getTestRootPath($input); $sourceFileRoot = $this->configHelper->getSourceFileRoot($input, $testFileRoot, $inSourceFile); $sourceFilePathRelativeToSourceRoot = $this->configHelper->getSourceFilePathRelativeToSourceRoot($sourceFileRoot, $inSourceFile); $outSourceFileDir = PathUtil::getPathUnderRoot($testFileRoot, $sourceFilePathRelativeToSourceRoot); $inputOptions = new Options($overwriteExistingDestinationFile, $testFileRoot, $sourceFileRoot, $outSourceFileDir, $sourceFilePathRelativeToSourceRoot, $generateSpec, $testBaseClassName); return $inputOptions; }