Ejemplo n.º 1
0
 /**
  * @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;
 }
Ejemplo n.º 2
0
 /**
  * @param InputInterface $input
  * @return string
  */
 public function getConfigFilePath(InputInterface $input)
 {
     $configFilePath = $input->getOption(CmdOption::CONFIG_FILE_PATH);
     if (!$configFilePath) {
         // If the option is not given in the command line,
         // null will be returned from the getOption call.
         $configFilePath = '';
         $pathPrefixToSearch = ['tests/', 'test/', ''];
         foreach ($pathPrefixToSearch as $prefix) {
             $pathCandidate = $prefix . self::DEFAULT_CONFIG_FILE_NAME;
             if ($this->fileFunctionWrapper->file_exists($pathCandidate)) {
                 $configFilePath = $pathCandidate;
                 break;
             }
         }
     }
     return $configFilePath;
 }