Example #1
0
    $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);
}
writelog('Path contains ' . count($file_list) . ' files for scanning');
// start a dispatcher for multi-processing
$dispatcher = new Snap_Dispatcher($php, __FILE__);
// build master test list
$analyzer = new Snap_FileAnalyzer();
$master_test_list = $dispatcher->dispatch(array('keys' => $file_list, 'dispatch' => array('analyze' => TRUE, 'verbose' => SNAPTEST_VERBOSE_MODE, 1 => '__KEY__'), 'onThreadComplete' => array($analyzer, 'onThreadComplete'), 'onThreadFail' => array($analyzer, 'onThreadFail'), 'onComplete' => array($analyzer, 'onComplete')));
unset($analyzer);
// build a master test key list
$master_test_key_list = array();
foreach ($master_test_list as $file => $classes) {
    if (!is_array($classes)) {
        die("File {$file} could not be read due to a fatal error:\n" . $classes . "\n");
    }
    foreach ($classes as $klass => $tests) {
        foreach ($tests as $test) {
            $master_test_key_list[] = Snap_Request::makeTestKey($file, $klass, $test);
        }
    }
Example #2
0
    require_once $test['file'];
    // add the class now that it exists
    $snap->addInput('local', $test['class']);
    // 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);
}
// start a dispatcher for multi-processing
$dispatcher = new Snap_Dispatcher($php, __FILE__);
// build master test list
$analyzer = new Snap_FileAnalyzer();
$master_test_list = $dispatcher->dispatch(array('keys' => $file_list, 'dispatch' => array('analyze' => TRUE, 1 => '$key'), 'onThreadComplete' => array($analyzer, 'onThreadComplete'), 'onThreadFail' => array($analyzer, 'onThreadFail'), 'onComplete' => array($analyzer, 'onComplete')));
unset($analyzer);
// build a master test key list
$master_test_key_list = array();
foreach ($master_test_list as $file => $classes) {
    if (!is_array($classes)) {
        die("File {$file} could not be read due to a fatal error:\n" . $classes . "\n");
    }
    foreach ($classes as $klass => $tests) {
        foreach ($tests as $test) {
            $master_test_key_list[] = Snap_Request::makeTestKey($file, $klass, $test);
        }
    }