Ejemplo n.º 1
0
 /**
  * Fired when the thread did not properly complete
  * For example, this is called when the remote end hangs up, segfaults,
  * or otherwise closes the connection unexpectedly.
  * @param $key a key that describes file/class/test that was running
  * @param $data the data payload for the key
  **/
 public function onThreadFail($key, $data)
 {
     $key = Snap_Request::decodeTestKey($key);
     $file = $key['file'];
     $class = $key['class'];
     $method = $key['method'];
     if (!$data) {
         $data = 'No error output captured. Please ensure your PHP environment allows output of errors.';
     }
     // remove start and end tokens
     $data = str_replace(array(SNAPTEST_TOKEN_START, SNAPTEST_TOKEN_END), '', $data);
     $report = array('type' => 'fatal', 'message' => $file . ' had a fatal error: ' . $data, 'skip_details' => TRUE);
     $this->report_list[] = $report;
     $this->reporter->announceTestFail($report);
 }
Ejemplo n.º 2
0
if ($analyze) {
    writelog('Doing analyze substep');
    $analyzer = new Snap_FileAnalyzer();
    $results = $analyzer->analyzeFile($path);
    echo SNAPTEST_TOKEN_START;
    echo serialize($results);
    echo SNAPTEST_TOKEN_END;
    echo SNAP_STREAM_ENDING_TOKEN;
    exit;
}
// test subprocess
if ($test) {
    // new reporter in phpserializer mode
    $snap = new Snap_Tester('phpserializer');
    // unencode
    $test = Snap_Request::decodeTestKey($test);
    // include the file, so that all base components are there
    require_once $test['file'];
    // add the class now that it exists
    $snap->addInput('local', $test['class']);
    writelog('Doing test substep: ' . $test['class'] . '::' . $test['method']);
    // run tests with an exact match on the test name
    $snap->runTests('^' . $test['method'] . '$');
    echo SNAP_STREAM_ENDING_TOKEN;
    exit;
}
// generate list of files to test
if (is_dir($path)) {
    $file_list = SNAP_recurse_directory($path, $xtn);
} else {
    $file_list = array($path);