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


PHP SimpleReporter::inCli方法代码示例

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


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

 /**
  *    Paints the title only.
  *    @param string $test_name        Name class of test.
  *    @access public
  */
 function paintHeader($test_name)
 {
     if (!SimpleReporter::inCli()) {
         header('Content-type: text/plain');
     }
     print "{$test_name}\n";
     flush();
 }
开发者ID:riaf,项目名称:pastit,代码行数:13,代码来源:TextDetailReporter.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: 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

示例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: 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

示例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()
{
    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

示例8: __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

示例9: 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

示例10: __construct

 /**
  * Assembles the appropriate reporter for the environment.
  */
 public function __construct()
 {
     if (SimpleReporter::inCli()) {
         $parser = new SimpleCommandLineParser($_SERVER['argv']);
         $this->doCodeCoverage = $parser->doCodeCoverage();
         $this->excludes = $parser->getExcludes();
         if ($parser->isXml()) {
             $interfaces = array('XmlReporter');
         } else {
             if ($parser->isJUnit()) {
                 $interfaces = array('JUnitXmlReporter');
             } else {
                 $interfaces = array('TextReporter');
             }
         }
         if ($parser->help()) {
             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:simpletest,项目名称:simpletest,代码行数:34,代码来源:default_reporter.php

示例11: __construct

 /**
  *  Assembles the appopriate reporter for the environment.
  */
 function __construct()
 {
     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());
         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:triasfahrudin,项目名称:siska21,代码行数:21,代码来源:default_reporter.php

示例12: paintHeader

 /**
  * Paints the test document header.
  *
  * @param string $test_name     First test top level to start.
  *
  * @abstract
  */
 public function paintHeader($test_name)
 {
     if (!SimpleReporter::inCli()) {
         header('Content-type: text/xml');
     }
     print '<?xml version="1.0"';
     if ($this->namespace) {
         print ' xmlns:' . $this->namespace . '="www.lastcraft.com/SimpleTest/Beta3/Report"';
     }
     print "?>\n";
     print '<' . $this->namespace . "run>\n";
 }
开发者ID:guicara,项目名称:simpletest,代码行数:19,代码来源:xml.php

示例13: paintDocumentStart

 /**
  * Sets the text/plain header if the test is not a CLI test.
  *
  * @return void
  */
 function paintDocumentStart()
 {
     if (!SimpleReporter::inCli()) {
         header('Content-type: text/plain');
     }
 }
开发者ID:cls1991,项目名称:ryzomcore,代码行数:11,代码来源:cake_text_reporter.php

示例14: _createDefaultReporter

 /**
  * @return SimpleReporter
  */
 function _createDefaultReporter()
 {
     if (SimpleReporter::inCli()) {
         $reporter = new TextReporter();
     } else {
         $reporter = new TracHtmlReporter();
     }
     return $reporter;
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:12,代码来源:TestRunner.php

示例15: paintHeader

 /**
  *    Paints the test document header.
  *    @param string $test_name     First test top level
  *                                 to start.
  *    @access public
  *    @abstract
  */
 function paintHeader($test_name)
 {
     if (!SimpleReporter::inCli()) {
         header('Content-type: text/xml');
     }
     print "<?xml version=\"1.0\"";
     if ($this->_namespace) {
         print " xmlns:" . $this->_namespace . "=\"www.lastcraft.com/SimpleTest/Beta3/Report\"";
     }
     print "?>\n";
     print "<" . $this->_namespace . "run>\n";
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:19,代码来源:xml.php


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