getTimeoutForLargeTests() публичный Метод

Returns the set timeout for large tests.
public getTimeoutForLargeTests ( ) : integer
Результат integer
Пример #1
0
 /**
  * Runs a test and collects its result in a TestResult instance.
  *
  * @param PHPUnit_Framework_TestResult $result
  *
  * @return PHPUnit_Framework_TestResult
  */
 public function run(PHPUnit_Framework_TestResult $result = null)
 {
     $sections = $this->parse();
     $code = $this->render($sections['FILE']);
     if ($result === null) {
         $result = new PHPUnit_Framework_TestResult();
     }
     $skip = false;
     $xfail = false;
     $time = 0;
     $settings = $this->settings;
     $result->startTest($this);
     if (isset($sections['INI'])) {
         $settings = array_merge($settings, $this->parseIniSection($sections['INI']));
     }
     if (isset($sections['ENV'])) {
         $env = $this->parseEnvSection($sections['ENV']);
         $this->phpUtil->setEnv($env);
     }
     // Redirects STDERR to STDOUT
     $this->phpUtil->setUseStderrRedirection(true);
     if ($result->enforcesTimeLimit()) {
         $this->phpUtil->setTimeout($result->getTimeoutForLargeTests());
     }
     if (isset($sections['SKIPIF'])) {
         $jobResult = $this->phpUtil->runJob($sections['SKIPIF'], $settings);
         if (!strncasecmp('skip', ltrim($jobResult['stdout']), 4)) {
             if (preg_match('/^\\s*skip\\s*(.+)\\s*/i', $jobResult['stdout'], $message)) {
                 $message = substr($message[1], 2);
             } else {
                 $message = '';
             }
             $result->addFailure($this, new PHPUnit_Framework_SkippedTestError($message), 0);
             $skip = true;
         }
     }
     if (isset($sections['XFAIL'])) {
         $xfail = trim($sections['XFAIL']);
     }
     if (!$skip) {
         if (isset($sections['STDIN'])) {
             $this->phpUtil->setStdin($sections['STDIN']);
         }
         if (isset($sections['ARGS'])) {
             $this->phpUtil->setArgs($sections['ARGS']);
         }
         PHP_Timer::start();
         $jobResult = $this->phpUtil->runJob($code, $settings);
         $time = PHP_Timer::stop();
         try {
             $this->assertPhptExpectation($sections, $jobResult['stdout']);
         } catch (PHPUnit_Framework_AssertionFailedError $e) {
             if ($xfail !== false) {
                 $result->addFailure($this, new PHPUnit_Framework_IncompleteTestError($xfail, 0, $e), $time);
             } else {
                 $result->addFailure($this, $e, $time);
             }
         } catch (Throwable $t) {
             $result->addError($this, $t, $time);
         }
         if ($result->allCompletelyImplemented() && $xfail !== false) {
             $result->addFailure($this, new PHPUnit_Framework_IncompleteTestError('XFAIL section but test passes'), $time);
         }
         $this->phpUtil->setStdin('');
         $this->phpUtil->setArgs('');
         if (isset($sections['CLEAN'])) {
             $cleanCode = $this->render($sections['CLEAN']);
             $this->phpUtil->runJob($cleanCode, $this->settings);
         }
     }
     $result->endTest($this, $time);
     return $result;
 }