Exemple #1
0
 /**
  * @dataProvider caseProvider
  */
 public function testJadeGeneration($name)
 {
     $result = get_test_result($name);
     $result = $result[1];
     $this->assertSame($result[1], $result[2], $name);
 }
Exemple #2
0
function get_tests_results($verbose = false)
{
    global $argv;
    $moreVerbose = array_remove($argv, '--verbose');
    if (!(ini_get('allow_url_include') | 0)) {
        echo "To accelerate the test execution, set in php.ini :\nallow_url_include = On\n\n";
    }
    $nav_list = build_list(find_tests());
    $success = 0;
    $failures = 0;
    $results = array();
    foreach ($nav_list as $type => $arr) {
        foreach ($arr as $e) {
            $name = $e['name'];
            if ($name === 'index' || isset($argv[1]) && false === stripos($argv[0], 'phpunit') && $name !== $argv[1] && $argv[1] !== '.') {
                continue;
            }
            if ($result = get_test_result($name, $verbose, $moreVerbose)) {
                $results[] = $result[1];
                if ($result[0]) {
                    $success++;
                } else {
                    $failures++;
                }
            }
        }
    }
    return array('success' => $success, 'failures' => $failures, 'results' => $results);
}
Exemple #3
0
                 $properties[$name] = !!get_par($name);
             } else {
                 $properties[$name] = get_par($name);
             }
         }
     }
     if ($clsOptions['options']) {
         foreach ($clsOptions['options'] as $name => $value) {
             if ($value === true || $value === false) {
                 $options[$name] = !!get_par($name);
             } else {
                 $options[$name] = get_par($name);
             }
         }
     }
     $result = get_test_result($class, $text, $properties, $options);
     if ($add && isLocal()) {
         add_test_case($cate, array("text" => $text, "result" => $result, "options" => $options, "properties" => $properties));
     } else {
         if (is_array($result)) {
             print_r($result);
         } else {
             echo $result;
         }
     }
 } elseif ($type == 'delTest') {
     $item = get_par('item');
     $md5 = get_par('md5');
     del_test_case($cate, $md5);
 } elseif ($type == 'getTest') {
     $md5 = get_par('md5');
Exemple #4
0
function get_tests_results($verbose = false)
{
    global $argv;
    $nav_list = build_list(find_tests());
    $success = 0;
    $failures = 0;
    $results = array();
    foreach ($nav_list as $type => $arr) {
        foreach ($arr as $e) {
            $name = $e['name'];
            if ($name == 'index' || isset($argv[1]) && false === stripos($argv[0], 'phpunit') && $name != $argv[1] && $argv[1] != '.') {
                continue;
            }
            $result = get_test_result($name, $verbose);
            $results[] = $result[1];
            if ($result[0]) {
                $success++;
            } else {
                $failures++;
                if (isset($argv[1]) && $argv[1] == '.') {
                    exit;
                }
            }
        }
    }
    return array('success' => $success, 'failures' => $failures, 'results' => $results);
}