/** * Load and save the existing tests/specs into the member variable. * Call this method first before using other methods of this class. * * @param \Box\TestScribe\Config\ConfigParams $inputParams * @param string $outSourceFileDir * * @return \Box\TestScribe\Spec\SpecsPerClass */ public function loadExistingSpecs(ConfigParams $inputParams, $outSourceFileDir) { $specFilePath = StaticConfigHelper::computeSpecFilePath($inputParams->getPhpClassName(), $outSourceFileDir); $this->specFilePath = $specFilePath; $inFullClassName = $inputParams->getFullClassName(); $this->specPerClass = $this->specPersistence->loadSpec($specFilePath, $inFullClassName); $this->methodName = $inputParams->getMethodName(); return $this->specPerClass; }
/** * @param \Box\TestScribe\Config\Options $options * @param \Box\TestScribe\Config\ConfigParams $inputParams * * @return \Box\TestScribe\Config\ConfigParams */ public function getOutputParams(Options $options, ConfigParams $inputParams) { $inFullClassName = $inputParams->getFullClassName(); $outFullClassName = $inFullClassName . 'GenTest'; $outPhpClassName = new PhpClassName($outFullClassName); $outSimpleClassName = $outPhpClassName->getClassName(); $outSourceFileDir = $options->getOutSourceFileDir(); $outSourceFilePath = $outSourceFileDir . DIRECTORY_SEPARATOR . $outSimpleClassName . '.php'; $overwriteExistingDestinationFile = $options->isOverwriteExistingDestinationFile(); $methodName = $inputParams->getMethodName(); $specPerClass = $this->savedSpecs->loadExistingSpecs($inputParams, $outSourceFileDir); $outTestMethodName = $this->outputTestNameGetter->getTestName($methodName, $overwriteExistingDestinationFile, $specPerClass); $outputParams = new ConfigParams($outSourceFilePath, $outPhpClassName, $outTestMethodName); return $outputParams; }