本文整理汇总了PHP中TextReporter类的典型用法代码示例。如果您正苦于以下问题:PHP TextReporter类的具体用法?PHP TextReporter怎么用?PHP TextReporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextReporter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPreference
public static function setPreference()
{
if (TextReporter::inCli()) {
SimpleTest::prefer(new Xml_Chris());
} else {
SimpleTest::prefer(new Html_Chris());
}
}
示例2: report
/**
* Genereates a nice report of the test.
*
* It instantiate a SimpleTest TestSuite and launches a Reporter.
* This method is typically called by a TestRunner.
*
* @return void
* @see KortTestRunner
* @see KortCliReporter
* @see KortHTMLReporter
*/
public function report()
{
$test = new \TestSuite($this->getLabel());
$test->add($this);
if (\TextReporter::inCli()) {
exit($test->run(new KortCliReporter()) ? 0 : 1);
}
$test->run(new KortHTMLReporter());
}
示例3: paintFooter
/**
* Capture the attempt to display the final test results and insert the
* ANSI-color codes in place.
*
* @param string
* @see TextReporter
* @access public
*/
function paintFooter($test_name)
{
ob_start();
parent::paintFooter($test_name);
$output = trim(ob_get_clean());
if ($output) {
if ($this->getFailCount() + $this->getExceptionCount() == 0) {
$color = $this->_passColor;
} else {
$color = $this->_failColor;
}
$this->_setColor($color);
echo $output;
$this->_resetColor();
}
}
示例4: dirname
<?php
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/reporter.php';
require_once dirname(__FILE__) . '/addendum_test.php';
require_once dirname(__FILE__) . '/acceptance_test.php';
require_once dirname(__FILE__) . '/annotation_test.php';
require_once dirname(__FILE__) . '/constrained_annotation_test.php';
require_once dirname(__FILE__) . '/annotation_parser_test.php';
require_once dirname(__FILE__) . '/doc_comment_test.php';
$suite = new TestSuite('All tests');
$suite->add(new TestOfAddendum());
$suite->add(new TestOfAnnotations());
$suite->add(new TestOfPerformanceFeatures());
$suite->add(new TestOfSupportingFeatures());
$suite->add(new TestOfAnnotation());
$suite->add(new TestOfAnnotationCollection());
$suite->add(new TestOfConstrainedAnnotation());
$suite->add(new TestOfMatchers());
$suite->add(new TestOfAnnotationMatchers());
$suite->add(new TestOfDocComment());
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
require_once dirname(__FILE__) . '/namespaces_test.php';
$suite->add(new TestOfNamespaces());
}
$reporter = TextReporter::inCli() ? new TextReporter() : new HtmlReporter();
Addendum::setRawMode(false);
$suite->run($reporter);
Addendum::setRawMode(true);
$suite->run($reporter);
示例5: 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());
}
示例6: ak_test
function ak_test($test_case_name, $use_sessions = false, $prevent_double_test_running = true, $custom_reporter = false)
{
static $ran_tests = array();
if (!isset($ran_tests[$test_case_name]) || !$prevent_double_test_running) {
if (!defined('ALL_TESTS_CALL')) {
$use_sessions ? @session_start() : null;
$test = new $test_case_name();
if (empty($custom_reporter)) {
if (defined('AK_CLI') && AK_CLI || TextReporter::inCli() || defined('AK_CONSOLE_MODE') && AK_CONSOLE_MODE || defined('AK_WEB_REQUEST') && !AK_WEB_REQUEST) {
$test->run(new TextReporter());
} else {
$test->run(new HtmlReporter());
}
} else {
$test->run(new $custom_reporter());
}
}
$ran_tests[$test_case_name] = true;
}
}
示例7: ak_test
function ak_test($test_case_name, $use_sessions = false)
{
if (!defined('ALL_TESTS_CALL')) {
$use_sessions ? @session_start() : null;
$test =& new $test_case_name();
if (defined('AK_CLI') && AK_CLI || TextReporter::inCli() || defined('AK_CONSOLE_MODE') && AK_CONSOLE_MODE || defined('AK_WEB_REQUEST') && !AK_WEB_REQUEST) {
$test->run(new TextReporter());
} else {
$test->run(new HtmlReporter());
}
}
}
示例8: paintFooter
/**
* Paints the end of the test with a summary of
* the passes and failures.
*
* @param string $test_name Name class of test.
* @access public
*/
function paintFooter($test_name)
{
parent::paintFooter($test_name);
echo 'Time taken by tests (in seconds): ' . $this->_timeDuration . "\n";
if (function_exists('memory_get_peak_usage')) {
echo 'Peak memory use: (in bytes): ' . number_format(memory_get_peak_usage()) . "\n";
}
}
示例9: paintPass
function paintPass($message)
{
parent::paintPass($message);
if ($this->verbose) {
print 'Pass ' . $this->getPassCount() . ") {$message}\n";
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
print "\tin " . implode("\n\tin ", array_reverse($breadcrumb));
print "\n";
}
}
示例10: paintPass
function paintPass($message)
{
parent::paintPass($message);
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
if ($this->lastfile != $breadcrumb[0]) {
print "{$breadcrumb['0']}\n";
$this->lastfile = $breadcrumb[0];
}
array_shift($breadcrumb);
print "\t" . implode(":", $breadcrumb) . ": OK\n";
//print ": $message\n";
}
示例11: paintException
function paintException($exception)
{
parent::paintException($exception);
print "Exception full message:\n";
print $exception->__toString();
$this->failed_tests[] = '[EXP] ' . $this->_extractExceptionFileAndLine($exception);
}
示例12: paintCaseEnd
function paintCaseEnd($test_name)
{
parent :: paintCaseEnd($test_name);
print $this->getTestCaseProgress() . " of " . $this->getTestCaseCount() . " done({$test_name})\n";
}
示例13: chr
function __construct()
{
parent::__construct();
$this->esc_start = chr(27) . '[';
}
示例14: paintMethodStart
/**
* Display the start of each method
*
* @param string $test_name
*/
function paintMethodStart($test_name)
{
parent::paintMethodStart($test_name);
print "Method: {$test_name}\n";
}
示例15: paintException
public function paintException($exception)
{
parent::paintException($exception);
print $exception->getTraceAsString();
print "\n";
}