/** * @param string $specFilePath * * @param string $fullClassName * * @return \Box\TestScribe\Spec\SpecsPerClass */ public function loadSpec($specFilePath, $fullClassName) { if ($this->fileFunctionWrapper->file_exists($specFilePath)) { $data = $this->yamlUtil->loadYamlFile($specFilePath); $specsPerClass = $this->specsPerClassPersistence->loadSpecsPerClass($data); } else { $specsPerClass = new SpecsPerClass($fullClassName, []); } return $specsPerClass; }
/** * @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; }