mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-02 12:21:09 +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['dry'] = false;
|
||||||
$AC['php'] = $php;
|
$AC['php'] = $php;
|
||||||
$AC['help'] = false;
|
$AC['help'] = false;
|
||||||
|
$AC['verbose'] = false;
|
||||||
|
|
||||||
$AC['type'] = '';
|
$AC['type'] = '';
|
||||||
$AC['disable-phpt'] = false;
|
$AC['disable-phpt'] = false;
|
||||||
@@ -47,7 +48,8 @@ $AC['only-phpt'] = false; // alias for --type=phpt
|
|||||||
|
|
||||||
$aliases = array(
|
$aliases = array(
|
||||||
'f' => 'file',
|
'f' => 'file',
|
||||||
'h' => 'help'
|
'h' => 'help',
|
||||||
|
'v' => 'verbose',
|
||||||
);
|
);
|
||||||
|
|
||||||
// It's important that this does not call the autoloader. Not a problem
|
// It's important that this does not call the autoloader. Not a problem
|
||||||
@@ -65,6 +67,7 @@ Allowed options:
|
|||||||
--php /path/to/php
|
--php /path/to/php
|
||||||
--type ( htmlpurifier | configdoc | fstools | htmlt | vtest | phpt )
|
--type ( htmlpurifier | configdoc | fstools | htmlt | vtest | phpt )
|
||||||
--disable-phpt
|
--disable-phpt
|
||||||
|
--verbose (-v)
|
||||||
<?php
|
<?php
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -88,7 +91,7 @@ if ($AC['xml']) {
|
|||||||
if (!SimpleReporter::inCli()) header('Content-Type: text/xml;charset=UTF-8');
|
if (!SimpleReporter::inCli()) header('Content-Type: text/xml;charset=UTF-8');
|
||||||
$reporter = new XmlReporter();
|
$reporter = new XmlReporter();
|
||||||
} elseif (SimpleReporter::inCli()) {
|
} elseif (SimpleReporter::inCli()) {
|
||||||
$reporter = new TextReporter();
|
$reporter = new HTMLPurifier_SimpleTest_TextReporter($AC);
|
||||||
} else {
|
} else {
|
||||||
$reporter = new HTMLPurifier_SimpleTest_Reporter('UTF-8', $AC);
|
$reporter = new HTMLPurifier_SimpleTest_Reporter('UTF-8', $AC);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user