/**
  * Get specific errors list
  *
  * @param string $file
  * @param string $code
  * @param bool   $returnLines
  * @return array
  * @throws \PHPUnit_Framework_Exception
  */
 protected function getSpecificErrorsList($file, $code, $returnLines = false)
 {
     $errors = self::$model->getErrors();
     if (!isset($errors[$file])) {
         throw new \PHPUnit_Framework_Exception('Errors for file ' . self::$fileTest . ' not found.');
     }
     $errors = $errors[$file];
     if (!isset($errors[$code])) {
         throw new \PHPUnit_Framework_Exception("Errors for code {$code} not found.");
     }
     $list = [];
     $key = $returnLines ? 'line' : 'value';
     foreach ($errors[$code] as $item) {
         if ($key == 'value' && isset($item['line'])) {
             $list[$item['line']] = $item[$key];
         } else {
             $list[] = $item[$key];
         }
     }
     return $list;
 }
Beispiel #2
0
 /**
  * Get specific errors list
  *
  * @param string $file
  * @param string $code
  * @return array
  * @throws \PHPUnit_Framework_Exception
  */
 protected function getSpecificErrorsList($file, $code)
 {
     $errors = self::$model->getErrors();
     if (!isset($errors[$file])) {
         throw new \PHPUnit_Framework_Exception('Errors for file ' . self::$classTest . ' not found.');
     }
     $errors = $errors[$file];
     if (!isset($errors[$code])) {
         throw new \PHPUnit_Framework_Exception("Errors for code {$code} not found.");
     }
     return $errors[$code];
 }
Beispiel #3
0
 /**
  * Add file to VCS
  *
  * @param string $file
  * @return $this
  */
 protected function addFileToVcs($file)
 {
     PreCommit::getVcsAdapter()->addPath($file);
     return $this;
 }