mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-30 19:00:10 +02:00
Add verbose mode to command line test runner.
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
18
tests/HTMLPurifier/SimpleTest/TextReporter.php
Normal file
18
tests/HTMLPurifier/SimpleTest/TextReporter.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
class HTMLPurifier_SimpleTest_TextReporter extends TextReporter {
|
||||
protected $verbose = false;
|
||||
function __construct($AC) {
|
||||
$this->verbose = $AC['verbose'];
|
||||
}
|
||||
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";
|
||||
}
|
||||
}
|
||||
}
|
@@ -40,6 +40,7 @@ $AC['xml'] = false;
|
||||
$AC['dry'] = false;
|
||||
$AC['php'] = $php;
|
||||
$AC['help'] = false;
|
||||
$AC['verbose'] = false;
|
||||
|
||||
$AC['type'] = '';
|
||||
$AC['disable-phpt'] = false;
|
||||
@@ -47,7 +48,8 @@ $AC['only-phpt'] = false; // alias for --type=phpt
|
||||
|
||||
$aliases = array(
|
||||
'f' => 'file',
|
||||
'h' => 'help'
|
||||
'h' => 'help',
|
||||
'v' => 'verbose',
|
||||
);
|
||||
|
||||
// It's important that this does not call the autoloader. Not a problem
|
||||
@@ -65,6 +67,7 @@ Allowed options:
|
||||
--php /path/to/php
|
||||
--type ( htmlpurifier | configdoc | fstools | htmlt | vtest | phpt )
|
||||
--disable-phpt
|
||||
--verbose (-v)
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
@@ -88,7 +91,7 @@ if ($AC['xml']) {
|
||||
if (!SimpleReporter::inCli()) header('Content-Type: text/xml;charset=UTF-8');
|
||||
$reporter = new XmlReporter();
|
||||
} elseif (SimpleReporter::inCli()) {
|
||||
$reporter = new TextReporter();
|
||||
$reporter = new HTMLPurifier_SimpleTest_TextReporter($AC);
|
||||
} else {
|
||||
$reporter = new HTMLPurifier_SimpleTest_Reporter('UTF-8', $AC);
|
||||
}
|
||||
|
Reference in New Issue
Block a user