本文整理汇总了PHP中SimpleReporter类的典型用法代码示例。如果您正苦于以下问题:PHP SimpleReporter类的具体用法?PHP SimpleReporter怎么用?PHP SimpleReporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SimpleReporter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: simpletest_autorun
/**
* Exit handler to run all recent test cases and exit system if in CLI
*/
function simpletest_autorun()
{
if (tests_have_run()) {
return;
}
$result = run_local_tests();
if (SimpleReporter::inCli()) {
exit($result ? 0 : 1);
}
}
开发者ID:sebs,项目名称:simpletest,代码行数:13,代码来源:autorun.php
示例3: simpletest_autorun
/**
* Exit handler to run all recent test cases and exit system if in CLI
*/
function simpletest_autorun() {
chdir($GLOBALS['SIMPLETEST_AUTORUNNER_INITIAL_PATH']);
if (tests_have_run()) {
return;
}
$result = run_local_tests();
if (SimpleReporter::inCli()) {
exit($result ? 0 : 1);
}
}
开发者ID:eltonsarmento,项目名称:CursosIAG,代码行数:13,代码来源:autorun.php
示例4: paintFail
function paintFail($message)
{
SimpleReporter::paintFail($message);
if ($this->getFailCount() <= 10) {
print $this->test_name . ": {$message}\n";
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
print "\tin " . implode("\n\tin ", array_reverse($breadcrumb));
print "\n";
}
}
开发者ID:bufvc,项目名称:bufvc-potnia-framework,代码行数:11,代码来源:unit_test.inc.php
示例5: DefaultReporter
/**
* Assembles the appopriate reporter for the environment.
*/
function DefaultReporter()
{
if (SimpleReporter::inCli()) {
global $argv;
$parser = new SimpleCommandLineParser($argv);
$interfaces = $parser->isXml() ? array('XmlReporter') : array('TextReporter');
$reporter =& new SelectiveReporter(SimpleTest::preferred($interfaces), $parser->getTestCase(), $parser->getTest());
} else {
$reporter =& new SelectiveReporter(SimpleTest::preferred('HtmlReporter'), @$_GET['c'], @$_GET['t']);
}
$this->SimpleReporterDecorator($reporter);
}
开发者ID:nsystem1,项目名称:ZeeJong,代码行数:15,代码来源:default_reporter.php
示例6: run
/**
* Invokes run() on all of the held test cases, instantiating
* them if necessary.
* @param SimpleReporter $reporter Current test reporter.
* @param int $port Port to report test results on
* @access public
*/
function run(&$reporter, $port)
{
$count = count($this->_test_cases);
for ($i = 0; $i < $count; $i++) {
if (is_string($this->_test_cases[$i])) {
$class = $this->_test_cases[$i];
$test =& new $class();
ob_start();
$reporter->paintGroupStart($this->getLabel(), $this->getSize());
$reporter->paintCaseStart($test->getLabel());
$start = ob_get_contents();
ob_end_clean();
ob_start();
$reporter->paintCaseEnd($test->getLabel());
$reporter->paintGroupEnd($this->getLabel());
$end = ob_get_contents();
ob_end_clean();
//the guts from SimpleTestCase::run($reporter) where
$test->_runner = new EclipseRunner($test, $reporter, $start, $end, $port);
$test->_runner->run();
$output = $start;
if ($i + 1 == $count) {
$output .= "<done/>";
}
$output .= $end;
$sock = new SimpleSocket("127.0.0.1", $port, 5);
$sock->write($output);
$sock->close();
echo $sock->getError();
} else {
$this->_test_cases[$i]->run($reporter, $port);
}
}
return $reporter->getStatus();
}
开发者ID:sebs,项目名称:simpletest,代码行数:42,代码来源:eclipsetest.php
示例7: simpletest_autorun
/**
* Exit handler to run all recent test cases if no test has
* so far been run. Uses the DefaultReporter which can have
* it's output controlled with SimpleTest::prefer().
*/
function simpletest_autorun()
{
if (tests_have_run()) {
return;
}
$candidates = array_intersect(capture_new_classes(), classes_defined_in_initial_file());
$loader = new SimpleFileLoader();
$suite = $loader->createSuiteFromClasses(basename(initial_file()), $loader->selectRunnableTests($candidates));
$result = $suite->run(new DefaultReporter());
if (SimpleReporter::inCli()) {
exit($result ? 0 : 1);
}
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:18,代码来源:autorun.php
示例8: simpletest_autorun
/**
* Exit handler to run all recent test cases if no test has
* so far been run. Uses the DefaultReporter which can have
* it's output controlled with SimpleTest::prefer().
*/
function simpletest_autorun()
{
try {
if (tests_have_run()) {
return;
}
$candidates = array_intersect(capture_new_classes(), classes_defined_in_initial_file());
$loader = new SimpleFileLoader();
$suite = $loader->createSuiteFromClasses(basename(initial_file()), $loader->selectRunnableTests($candidates));
$result = $suite->run(new DefaultReporter());
} catch (Exception $e) {
// This is here, because under normal circumstances shutdown
// functions don't have a stack frame, leading to obscure errors.
echo $e->__toString();
$result = false;
}
if (SimpleReporter::inCli()) {
exit($result ? 0 : 1);
}
}
开发者ID:googlecode-mirror,项目名称:bulldoc,代码行数:25,代码来源:autorun.php
示例9: __construct
/**
* Assembles the appropriate reporter for the environment.
*/
function __construct()
{
if (SimpleReporter::inCli()) {
$parser = new SimpleCommandLineParser($_SERVER['argv']);
$interfaces = $parser->isXml() ? array('XmlReporter') : array('TextReporter');
if ($parser->help()) {
// I'm not sure if we should do the echo'ing here -- ezyang
echo $parser->getHelpText();
exit(1);
}
$reporter = new SelectiveReporter(SimpleTest::preferred($interfaces), $parser->getTestCase(), $parser->getTest());
if ($parser->noSkips()) {
$reporter = new NoSkipsReporter($reporter);
}
} else {
$reporter = new SelectiveReporter(SimpleTest::preferred('HtmlReporter'), @$_GET['c'], @$_GET['t']);
if (@$_GET['skips'] == 'no' || @$_GET['show-skips'] == 'no') {
$reporter = new NoSkipsReporter($reporter);
}
}
parent::__construct($reporter);
}
开发者ID:JamesLinus,项目名称:platform,代码行数:25,代码来源:default_reporter.php
示例10: UnitTests
{
function UnitTests()
{
$this->GroupTest("Unit tests");
$this->addTestFile("errors_test.php");
$this->addTestFile("options_test.php");
$this->addTestFile("dumper_test.php");
$this->addTestFile("expectation_test.php");
$this->addTestFile("simple_mock_test.php");
$this->addTestFile("adapter_test.php");
$this->addTestFile("socket_test.php");
$this->addTestFile("query_string_test.php");
$this->addTestFile("http_test.php");
$this->addTestFile("user_agent_test.php");
$this->addTestFile("browser_test.php");
$this->addTestFile("parser_test.php");
$this->addTestFile("tag_test.php");
$this->addTestFile("page_test.php");
$this->addTestFile("frames_test.php");
$this->addTestFile("shell_tester_test.php");
$this->addTestFile("xml_test.php");
}
}
if (!defined("TEST_RUNNING")) {
define("TEST_RUNNING", true);
$test =& new UnitTests();
if (SimpleReporter::inCli()) {
exit($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:31,代码来源:unit_tests.php
示例11: run
/**
* Sends a single error to the reporter.
* @param SimpleReporter $reporter Current test reporter.
* @access public
*/
function run(&$reporter) {
$reporter->paintGroupStart($this->getLabel(), $this->getSize());
$reporter->paintFail('Bad TestSuite [' . $this->getLabel() .
'] with error [' . $this->_error . ']');
$reporter->paintGroupEnd($this->getLabel());
return $reporter->getStatus();
}
开发者ID:nuckey,项目名称:moodle,代码行数:12,代码来源:test_case.php
示例12: paintFail
function paintFail($message)
{
// We need to bypass parent::paintFail to increment failures without printing its message.
SimpleReporter::paintFail($message);
print "<blockquote><strong><span class=\"fail\">Fail</span>: {$message}</strong></blockquote>\n";
}
开发者ID:ssrsfs,项目名称:blg,代码行数:6,代码来源:setup.php
示例13: paintEnd
/**
* Signals the appropriate end event on the
* listener.
* @param SimpleReporter $listener Target for events.
* @access public
*/
function paintEnd(&$listener)
{
$listener->paintGroupEnd($this->getName());
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:10,代码来源:xml.php
示例14: runTestCase
/**
* Run a single test case with the given name, using the provided output format.
* @param string $testName
* @param string $format (xml, text or html)
* @return int
*/
public function runTestCase($testName, $format = Sweety_Runner::REPORT_TEXT)
{
foreach ($this->_testLocators as $locator) {
if ($locator->includeTest($testName)) {
break;
}
}
$testClass = new ReflectionClass($testName);
if ($testClass->getConstructor()) {
//We don't want test output to be cached
if (!SimpleReporter::inCli()) {
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
}
switch ($format) {
case Sweety_Runner::REPORT_HTML:
$reporter = new HtmlReporter();
break;
case Sweety_Runner::REPORT_XML:
if (!SimpleReporter::inCli()) {
header("Content-Type: text/xml");
//Sigh! SimpleTest (skip() issues).
}
$reporter = new XmlReporter();
break;
case Sweety_Runner::REPORT_TEXT:
default:
$reporter = new TextReporter();
break;
}
$test = $testClass->newInstance();
return $test->run($reporter) ? 0 : 1;
}
return 1;
}
开发者ID:mahersafadi,项目名称:joindin-api,代码行数:42,代码来源:AbstractTestRunner.php
示例15: paintSignal
/**
* Handle failinfo message
*/
function paintSignal($type, $message)
{
parent::paintSignal($type, $message);
if ($type = 'failinfo') {
$this->_failinfo = $message;
}
}
开发者ID:pyfun,项目名称:dokuwiki,代码行数:10,代码来源:cli_reporter.php
示例16: paintError
function paintError($message)
{
parent::paintError($message);
$this->_response->addContent("Error !!\n");
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
$this->_response->addContent("\tin " . implode("\n\tin ", array_reverse($breadcrumb)));
$this->_response->addContent("\n\t " . $message . "\n");
}
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:9,代码来源:jtextrespreporter.class.php
示例17: paintSkip
function paintSkip($message)
{
parent::paintSkip($message);
$str = "<span class=\"pass\">Skipped</span>: ";
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
$str .= implode(" -> ", $breadcrumb);
$str .= " -> " . $this->_htmlEntities($message) . "<br />\n";
$this->_response->body->append('MAIN', $str);
}
开发者ID:jelix,项目名称:simpletest-module,代码行数:10,代码来源:jhtmlrespreporter.class.php
示例18: paintError
function paintError($message)
{
parent::paintError($message);
$str = "<span class=\"fail\">Exception</span>: ";
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
$str .= implode(" -> ", $breadcrumb);
$str .= " -> <strong>" . $this->_htmlEntities($message) . "</strong><br />\n";
$this->_response->body->append('MAIN', $str);
}
开发者ID:alienpham,项目名称:helenekling,代码行数:10,代码来源:jhtmlrespreporter.class.php
示例19: paintFail
function paintFail($message)
{
parent::paintFail($message);
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
$test = implode("->", $breadcrumb);
$result["time"] = time();
$result["status"] = "Failed";
$result["test"] = $test;
$result["message"] = $message;
$this->results[] = $result;
}
开发者ID:sebs,项目名称:simpletest,代码行数:12,代码来源:recorder.php
示例20: paintGroupEnd
/**
* acceptor for end of test group.
* final group pops the collected treemap nodes and assigns it to the internal graph property.
*/
public function paintGroupEnd($message)
{
$node = $this->_stack->pop();
$current = $this->_stack->peek();
if ($current) {
if ($node->isFailed()) {
$current->fail();
}
$current->putChild($node);
} else {
$this->_graph = $node;
}
parent::paintGroupEnd($message);
}
开发者ID:guicara,项目名称:simpletest,代码行数:18,代码来源:treemap_recorder.php
注:本文中的SimpleReporter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论