From 527f154d3df5c4d9b87b4004a9c38bca02da121c Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sun, 23 Nov 2008 20:45:21 -0500 Subject: [PATCH] Add verbose mode to command line test runner. Signed-off-by: Edward Z. Yang --- tests/HTMLPurifier/SimpleTest/TextReporter.php | 18 ++++++++++++++++++ tests/index.php | 7 +++++-- 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 tests/HTMLPurifier/SimpleTest/TextReporter.php diff --git a/tests/HTMLPurifier/SimpleTest/TextReporter.php b/tests/HTMLPurifier/SimpleTest/TextReporter.php new file mode 100644 index 00000000..77b9f388 --- /dev/null +++ b/tests/HTMLPurifier/SimpleTest/TextReporter.php @@ -0,0 +1,18 @@ +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"; + } + } +} diff --git a/tests/index.php b/tests/index.php index c706ffb5..9ed3d8bc 100755 --- a/tests/index.php +++ b/tests/index.php @@ -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)