当前位置: 首页>>代码示例>>PHP>>正文


PHP GroupTest::run方法代码示例

本文整理汇总了PHP中GroupTest::run方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupTest::run方法的具体用法?PHP GroupTest::run怎么用?PHP GroupTest::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GroupTest的用法示例。


在下文中一共展示了GroupTest::run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: call_simpletest

 public static function call_simpletest($task, $type = 'text', $dirs = array())
 {
     // remove E_STRICT because simpletest is not E_STRICT compatible
     $old_error_reporting = error_reporting();
     $new_error_reporting = $old_error_reporting;
     if ($new_error_reporting & E_STRICT) {
         $new_error_reporting = $new_error_reporting ^ E_STRICT;
     }
     include_once 'simpletest/unit_tester.php';
     include_once 'simpletest/web_tester.php';
     if (!class_exists('GroupTest')) {
         throw new pakeException('You must install SimpleTest to use this task.');
     }
     require_once 'simpletest/reporter.php';
     require_once 'simpletest/mock_objects.php';
     set_include_path('test' . PATH_SEPARATOR . 'lib' . PATH_SEPARATOR . get_include_path());
     $base_test_dir = 'test';
     $test_dirs = array();
     // run tests only in these subdirectories
     if ($dirs) {
         foreach ($dirs as $dir) {
             $test_dirs[] = $base_test_dir . DIRECTORY_SEPARATOR . $dir;
         }
     } else {
         $test_dirs[] = $base_test_dir;
     }
     $test = new GroupTest('Test suite in (' . implode(', ', $test_dirs) . ')');
     $files = pakeFinder::type('file')->name('*Test.php')->in($test_dirs);
     if (count($files) > 0) {
         foreach ($files as $file) {
             $test->addTestFile($file);
         }
         ob_start();
         if ($type == 'html') {
             $result = $test->run(new HtmlReporter());
         } else {
             if ($type == 'xml') {
                 $result = $test->run(new XmlReporter());
             } else {
                 $result = $test->run(new TextReporter());
             }
         }
         $content = ob_get_contents();
         ob_end_clean();
         if ($task->is_verbose()) {
             echo $content;
         }
     } else {
         throw new pakeException('No test to run.');
     }
     error_reporting($old_error_reporting);
 }
开发者ID:piotras,项目名称:pake,代码行数:52,代码来源:pakeSimpletestTask.class.php

示例2: run

 public function run()
 {
     $test = new GroupTest("Piwik - running '{$this->testGroupType}' tests...");
     $intro = '';
     if (!$this->databaseRequired) {
         $intro .= $this->getTestDatabaseInfoMessage();
     }
     $intro .= self::$testsHelpLinks . "<hr/>";
     $intro .= $this->introAppend;
     $toInclude = array();
     foreach ($this->dirsToGlob as $dir) {
         $toInclude = array_merge($toInclude, Piwik::globr(PIWIK_INCLUDE_PATH . $dir, '*.test.php'));
     }
     // if present, make sure Database.test.php is first
     $idx = array_search(PIWIK_INCLUDE_PATH . '/tests/core/Database.test.php', $toInclude);
     if ($idx !== FALSE) {
         unset($toInclude[$idx]);
         array_unshift($toInclude, PIWIK_INCLUDE_PATH . '/tests/core/Database.test.php');
     }
     foreach ($toInclude as $file) {
         $test->addFile($file);
     }
     $result = $test->run(new HtmlTimerReporter($intro));
     if (SimpleReporter::inCli()) {
         exit($result ? 0 : 1);
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:27,代码来源:TestRunner.php

示例3: fromDir

 public static function fromDir($name, $dir)
 {
     $classes = array();
     $dh = opendir($dir);
     while ($file = readdir($dh)) {
         if (!preg_match('/[.]php$/i', $file)) {
             continue;
         }
         if ($file == 'suite.php') {
             continue;
         }
         $className = preg_replace('/[.]php$/i', '', $file);
         array_push($classes, $className);
         $file = "{$dir}/{$file}";
         require_once $file;
     }
     closedir($dh);
     $test = new GroupTest($name);
     if (count($classes)) {
         foreach ($classes as $class) {
             $test->addTestCase(new $class());
         }
     } else {
         $test->addTestCase(new __tctemp());
     }
     $test->run(new DefaultReporter());
 }
开发者ID:bprudent,项目名称:framework,代码行数:27,代码来源:FrameworkTestSuite.php

示例4: run

 function run(&$reporter)
 {
     global $UNITTEST;
     $UNITTEST->running = true;
     $return = parent::run($reporter);
     unset($UNITTEST->running);
     return $return;
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:8,代码来源:ex_simple_test.php

示例5: foreach

 function generar_layout()
 {
     $selecciones = $this->controlador->get_selecciones();
     echo "<div style='background-color: white; border: 1px solid black; text-align: left; padding: 15px'>";
     try {
         //Se construye un suite por categoria que tenga test seleccionados
         foreach (toba_test_lista_casos::get_categorias() as $categoria) {
             $test = new GroupTest($categoria['nombre']);
             $hay_uno = false;
             foreach (toba_test_lista_casos::get_casos() as $caso) {
                 if ($caso['categoria'] == $categoria['id'] && in_array($caso['id'], $selecciones['casos'])) {
                     $hay_uno = true;
                     require_once $caso['archivo'];
                     $test->addTestCase(new $caso['id']($caso['nombre']));
                 }
             }
             if ($hay_uno) {
                 //--- COBERTURA DE CODIGO (OPCIONAL) ----
                 if (function_exists('xdebug_start_code_coverage')) {
                     xdebug_start_code_coverage();
                 }
                 //-------
                 $test->run(new toba_test_reporter());
                 //--- COBERTURA DE CODIGO (OPCIONAL) ----
                 $arch = 'PHPUnit2/Util/CodeCoverage/Renderer.php';
                 $existe = toba_manejador_archivos::existe_archivo_en_path($arch);
                 if (function_exists('xdebug_start_code_coverage') && $existe) {
                     require_once $arch;
                     $cubiertos = xdebug_get_code_coverage();
                     //Se limpian las referencias a simpletest y a librerias de testing en gral.
                     $archivos = array();
                     foreach (array_keys($cubiertos) as $archivo) {
                         if (!strpos($archivo, 'simpletest') && !strpos($archivo, 'PHPUnit') && !strpos($archivo, 'testing_automatico/') && !strpos($archivo, '/test_')) {
                             $archivos[$archivo] = $cubiertos[$archivo];
                         }
                     }
                     $cc = PHPUnit2_Util_CodeCoverage_Renderer::factory('HTML', array('tests' => $archivos));
                     $path_temp = toba::proyecto()->get_path_temp_www();
                     $salida = $path_temp['real'] . '/cobertura.html';
                     $cc->renderToFile($salida);
                     echo "<a href='{$path_temp['browser']}/cobertura.html' target='_blank'>Ver cobertura de código</a>";
                 }
                 //-------
             }
         }
     } catch (Exception $e) {
         if (method_exists($e, 'mensaje_web')) {
             echo ei_mensaje($e->mensaje_web(), 'error');
         } else {
             echo $e;
         }
     }
     echo '</div><br>';
     $this->dep('lista_archivos')->generar_html();
 }
开发者ID:emma5021,项目名称:toba,代码行数:55,代码来源:casos_web.php

示例6: define

<?php

require 'diff/difflib.php';
require 'diff/diffhtml.php';
if (!defined('SIMPLE_TEST')) {
    define('SIMPLE_TEST', 'simpletest/');
}
require_once SIMPLE_TEST . 'unit_tester.php';
require_once SIMPLE_TEST . 'reporter.php';
require_once SIMPLE_TEST . 'myhtmlreporter.class.php';
require_once SIMPLE_TEST . 'junittestcase.class.php';
require_once '../jtpl_standalone_prepend.php';
require_once 'compiler.php';
require_once 'expressions_parsing.php';
jTplConfig::$lang = 'fr';
$test = new GroupTest('All tests');
$test->addTestCase(new UTjtplcontent());
$test->addTestCase(new UTjtplexpr());
$test->run(new myHtmlReporter());
开发者ID:hadrienl,项目名称:jelix,代码行数:19,代码来源:index.php

示例7: startedIndexPhp

* test installation
*/
#$grouptest = new GroupTest('Installation');
#$grouptest->addTestFile('test_install.php');
#$grouptest->run(new HtmlReporter());
#
### create a function to make sure we are starting at index.php ###
function startedIndexPhp()
{
    return true;
}
### include some core libraries ###
require_once '../std/common.inc.php';
require_once dirname(__FILE__) . '/../conf/conf.inc.php';
require_once dirname(__FILE__) . '/class.test_environment.php';
#confChange('DB_TABLE_PREFIX_UNITTEST', '');   # overwrite development database!!!
TestEnvironment::initStreberUrl();
TestEnvironment::prepare('fixtures/project_setup.sql');
$grouptest = new GroupTest('Efforts');
$grouptest->addTestFile('test_efforts.php');
$grouptest->run(new HtmlReporter());
$grouptest = new GroupTest('Item visibility');
$grouptest->addTestFile('test_item_visibility.php');
$grouptest->run(new HtmlReporter());
$grouptest = new GroupTest('Login logic');
$grouptest->addTestFile('test_pages_login.php');
$grouptest->run(new HtmlReporter());
$grouptest = new GroupTest('Render all pages');
$grouptest->addTestFile('test_pages_all.php');
$result = $grouptest->run(new HtmlReporter());
#TestEnvironment::prepare('fixtures/remove_tables.sql');
开发者ID:Bremaweb,项目名称:streber-1,代码行数:31,代码来源:testsuite_pages.php

示例8: implode

        $breadcrumb = $this->getTestList();
        array_shift($breadcrumb);
        print implode(" -&gt; ", $breadcrumb);
        print " -&gt; " . htmlentities($message) . "<br />\n";
    }
    function paintSignal($type, &$payload)
    {
        print "<span class=\"fail\">{$type}</span>: ";
        $breadcrumb = $this->getTestList();
        array_shift($breadcrumb);
        print implode(" -&gt; ", $breadcrumb);
        print " -&gt; " . htmlentities(serialize($payload)) . "<br />\n";
    }
}
$test = new GroupTest("Visual test with 50 passes, 50 fails and 5 exceptions");
$test->addTestCase(new TestOfUnitTestCaseOutput());
$test->addTestCase(new TestOfMockObjectsOutput());
$test->addTestCase(new TestOfPastBugs());
$test->addTestCase(new TestOfVisualShell());
if (isset($_GET['xml']) || in_array('xml', isset($argv) ? $argv : array())) {
    $reporter = new XmlReporter();
} elseif (TextReporter::inCli()) {
    $reporter = new TextReporter();
} else {
    $reporter = new PassesAsWellReporter();
}
if (isset($_GET['dry']) || in_array('dry', isset($argv) ? $argv : array())) {
    $reporter->makeDry();
}
exit($test->run($reporter) ? 0 : 1);
开发者ID:Hassanj343,项目名称:candidats,代码行数:30,代码来源:visual_test.php

示例9: exit

    exit(1);
}
require_once SIMPLE_TEST . 'unit_tester.php';
require_once SIMPLE_TEST . 'reporter.php';
if (!empty($argc) and $argc > 1) {
    /* If command line arguments are given, then only test those. */
    array_shift($argv);
    $tests = $argv;
    $group = new GroupTest('Selected PEL tests');
} else {
    /* otherwive test all .php files, except this file (run-tests.php). */
    $tests = array_diff(glob('*.php'), array('run-tests.php', 'config.local.php', 'config.local.example.php'));
    $group = new GroupTest('All PEL tests');
    /* Also test all image tests (if they are available). */
    if (is_dir('image-tests')) {
        $image_tests = array_diff(glob('image-tests/*.php'), array('image-tests/make-image-test.php'));
        $image_group = new GroupTest('Image Tests');
        foreach ($image_tests as $image_test) {
            $image_group->addTestFile($image_test);
        }
        $group->addTestCase($image_group);
    } else {
        echo "Found no image tests, only core functionality will be tested.\n";
        echo "Image tests are available from http://pel.sourceforge.net/.\n";
    }
}
foreach ($tests as $test) {
    $group->addTestFile($test);
}
$group->run(new TextReporter());
开发者ID:kbrack1,项目名称:UptoBox,代码行数:30,代码来源:run-tests.php

示例10: single

 function single()
 {
     $rep = $this->_prepareResponse();
     $module = $this->param('mod');
     $testname = $this->param('test');
     if (isset($this->testsList[$module])) {
         $reporter = jClasses::create("junittests~jtextrespreporter");
         jClasses::inc('junittests~junittestcase');
         jClasses::inc('junittests~junittestcasedb');
         $reporter->setResponse($rep);
         foreach ($this->testsList[$module] as $test) {
             if ($test[1] == $testname) {
                 $group = new GroupTest('"' . $module . '" module , ' . $test[2]);
                 $group->addTestFile($GLOBALS['gJConfig']->_modulesPathList[$module] . 'tests/' . $test[0]);
                 jContext::push($module);
                 $result = $group->run($reporter);
                 if (!$result) {
                     $rep->setExitCode(jResponseCmdline::EXIT_CODE_ERROR);
                 }
                 jContext::pop();
                 break;
             }
         }
     } else {
         $rep->addContent("\n" . 'no tests for "' . $module . '" module.' . "\n");
     }
     return $this->_finishResponse($rep);
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:28,代码来源:default.cmdline.php

示例11: run_tests

 public function run_tests($argv)
 {
     error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
     define("ENV", "test");
     $this->app_setup();
     define("CLI_ENV", true);
     if (!(include 'simpletest/unit_tester.php') || !(include 'simpletest/mock_objects.php')) {
         throw new WXDependencyException("Simpletest library required. Install it somewhere in the include path", "Simpletest Dependency Failure");
     }
     if ($argv[1] == "wax") {
         $testdir = FRAMEWORK_DIR . "/tests";
     } elseif ($argv[1] && is_dir(PLUGIN_DIR . $argv[1] . "/tests")) {
         $testdir = PLUGIN_DIR . $argv[1] . "/tests";
     } else {
         $testdir = APP_DIR . "tests";
     }
     AutoLoader::include_dir($testdir);
     $test = new GroupTest('All tests');
     foreach (scandir($testdir) as $file) {
         if (substr($file, -3) == "php" && substr($file, 0, 1) != ".") {
             $class = substr($file, 0, -4);
             $test->addTestClass($class);
         }
     }
     if (TextReporter::inCli()) {
         exit($test->run(new TextReporter()) ? 0 : 1);
     }
     $test->run(new HtmlReporter());
 }
开发者ID:phpwax,项目名称:phpwax,代码行数:29,代码来源:WXScripts.php

示例12: array

// Configuration
$simpletest_location = 'simpletest/';
if (file_exists('../test-settings.php')) {
    include_once '../test-settings.php';
}
// Includes
require_once '../class.csstidy.php';
require_once 'Text/Diff.php';
require_once 'Text/Diff/Renderer.php';
require_once $simpletest_location . 'unit_tester.php';
require_once $simpletest_location . 'reporter.php';
require_once 'unit-tests/class.csstidy_reporter.php';
require_once 'unit-tests/class.csstidy_harness.php';
require_once 'unit-tests.inc';
// Test files
$test_files = array();
require 'unit-tests/_files.php';
// Setup test files
$test = new GroupTest('CSSTidy unit tests');
foreach ($test_files as $test_file) {
    require_once "unit-tests/{$test_file}";
    list($x, $class_suffix) = explode('.', $test_file);
    $test->addTestClass("csstidy_test_{$class_suffix}");
}
if (SimpleReporter::inCli()) {
    $reporter = new TextReporter();
} else {
    $reporter = new csstidy_reporter('UTF-8');
}
$test->run($reporter);
开发者ID:rodrigorm,项目名称:csstidy,代码行数:30,代码来源:unit-tests.php

示例13: ConsoleOptions

// include_once('simpletest/web_tester.php');
include_once 'simpletest/unit_tester.php';
include_once 'simpletest/reporter.php';
include_once 'configurator/LoggerConfigurator.php';
include_once 'logger/Logger.php';
// }}}
// {{{ configure console
$options = new ConsoleOptions();
$options->setNoValueFor('debug', '-d', '--debug');
$options->load(isset($argv) ? $argv : $_SERVER['argv']);
$options->alias('debug', '-d, --debug');
// }}}
// {{{ logger.
$logger = new Logger(new LoggerConfigurator());
// }}}
$test = new GroupTest("=== Medick Framework Unit Tests ===");
$test_files = Folder::recursiveFindRelative('.', 'test', 'Test.php');
foreach ($test_files as $file) {
    if ($options->has('debug')) {
        $logger->debug('Adding test file: ' . $file);
    }
    $test->addTestFile($file);
}
$test->run(new TextReporter());
if ($options->has('debug')) {
    $time_end = microtime(true);
    $logger->debug('Done in ' . round($time_end - $time_start, 4) . ' seconds');
}
// {{{ clean-up
@unlink(TMP . 'test.db');
// }}}
开发者ID:BackupTheBerlios,项目名称:medick-svn,代码行数:31,代码来源:runner.php

示例14: define

<?php

defined('ALL_TESTS_CALL') ? null : define("ALL_TESTS_CALL", true);
defined('AK_ENABLE_PROFILER') ? null : define('AK_ENABLE_PROFILER', true);
defined('AK_TEST_DATABASE_ON') ? null : define('AK_TEST_DATABASE_ON', true);
require_once dirname(__FILE__) . '/../../fixtures/config/config.php';
if (!defined('ALL_TESTS_RUNNER') && empty($test)) {
    $test = new GroupTest('Akelos Framework Active Record Tests');
    define('ALL_TESTS_RUNNER', false);
    @session_start();
}
//these partials are not refactored yet. so they must be run in sequence!
$partial_tests = array('_AkActiveRecord_1.php', '_AkActiveRecord_2.php', '_AkActiveRecord_3.php');
foreach ($partial_tests as $partial_test) {
    $test->addTestFile(AK_LIB_TESTS_DIRECTORY . DS . 'AkActiveRecord' . DS . $partial_test);
}
foreach (Ak::dir(AK_LIB_TESTS_DIRECTORY . DS . 'AkActiveRecord') as $active_record_test) {
    if (!is_array($active_record_test) && !in_array($active_record_test, $partial_tests)) {
        if (!ALL_TESTS_RUNNER || $active_record_test[0] == '_') {
            $test->addTestFile(AK_LIB_TESTS_DIRECTORY . DS . 'AkActiveRecord' . DS . $active_record_test);
        }
    }
}
if (!ALL_TESTS_RUNNER) {
    if (TextReporter::inCli()) {
        exit($test->run(new TextReporter()) ? 0 : 1);
    }
    $test->run(new HtmlReporter());
}
开发者ID:joeymetal,项目名称:v1,代码行数:29,代码来源:AkActiveRecord.php

示例15: run

 /**
  *  ユニットテストを実行する
  *
  *  @access private
  *  @return mixed   0:正常終了 Ethna_Error:エラー
  */
 function run()
 {
     $action_class_list = $this->_getTestAction();
     $view_class_list = $this->_getTestView();
     $test = new GroupTest("Ethna UnitTest");
     // アクション
     foreach ($action_class_list as $action_name) {
         $action_class = $this->ctl->getDefaultActionClass($action_name, false) . '_TestCase';
         $action_form = $this->ctl->getDefaultFormClass($action_name, false) . '_TestCase';
         $test->addTestCase(new $action_class($this->ctl));
         $test->addTestCase(new $action_form($this->ctl));
     }
     // ビュー
     foreach ($view_class_list as $view_name) {
         $view_class = $this->ctl->getDefaultViewClass($view_name, false) . '_TestCase';
         $test->addTestCase(new $view_class($this->ctl));
     }
     // 一般
     foreach ($this->testcase as $class_name => $file_name) {
         $dir = $this->ctl->getBasedir() . '/';
         include_once $dir . $file_name;
         $testcase_name = $class_name . '_TestCase';
         $test->addTestCase(new $testcase_name($this->ctl));
     }
     // ActionFormのバックアップ
     $af = $this->ctl->getActionForm();
     //出力したい形式にあわせて切り替える
     $cli_enc = $this->ctl->getClientEncoding();
     $reporter = new Ethna_UnitTestReporter($cli_enc);
     $test->run($reporter);
     // ActionFormのリストア
     $this->ctl->action_form = $af;
     $this->backend->action_form = $af;
     $this->backend->af = $af;
     return array($reporter->report, $reporter->result);
 }
开发者ID:riaf,项目名称:pastit,代码行数:42,代码来源:UnitTestManager.php


注:本文中的GroupTest::run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。