mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-22 08:21:52 +00:00
Modernize some of the testing facilities.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
parent
1c7fedff5a
commit
56a26cab14
@ -23,11 +23,11 @@ class CliTestCase
|
|||||||
public function getLabel() {
|
public function getLabel() {
|
||||||
return $this->_command;
|
return $this->_command;
|
||||||
}
|
}
|
||||||
public function run(&$reporter) {
|
public function run($reporter) {
|
||||||
if (!$this->_quiet) $reporter->paintFormattedMessage('Running ['.$this->_command.']');
|
if (!$this->_quiet) $reporter->paintFormattedMessage('Running ['.$this->_command.']');
|
||||||
return $this->_invokeCommand($this->_command, $reporter);
|
return $this->_invokeCommand($this->_command, $reporter);
|
||||||
}
|
}
|
||||||
public function _invokeCommand($command, &$reporter) {
|
public function _invokeCommand($command, $reporter) {
|
||||||
$xml = shell_exec($command);
|
$xml = shell_exec($command);
|
||||||
if (! $xml) {
|
if (! $xml) {
|
||||||
if (!$this->_quiet) {
|
if (!$this->_quiet) {
|
||||||
@ -35,7 +35,7 @@ class CliTestCase
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$parser = &$this->_createParser($reporter);
|
$parser = $this->_createParser($reporter);
|
||||||
|
|
||||||
set_error_handler(array($this, '_errorHandler'));
|
set_error_handler(array($this, '_errorHandler'));
|
||||||
$status = $parser->parse($xml);
|
$status = $parser->parse($xml);
|
||||||
@ -59,7 +59,7 @@ class CliTestCase
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public function &_createParser(&$reporter) {
|
public function _createParser($reporter) {
|
||||||
$parser = new SimpleTestXmlParser($reporter);
|
$parser = new SimpleTestXmlParser($reporter);
|
||||||
return $parser;
|
return $parser;
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,14 @@ if ($AC['standalone']) {
|
|||||||
require '../library/HTMLPurifier.autoload.php';
|
require '../library/HTMLPurifier.autoload.php';
|
||||||
require 'HTMLPurifier/Harness.php';
|
require 'HTMLPurifier/Harness.php';
|
||||||
|
|
||||||
|
// immediately load external libraries, so we can bail out early if
|
||||||
|
// they're bad
|
||||||
|
if ($GLOBALS['HTMLPurifierTest']['PEAR']) {
|
||||||
|
if ($GLOBALS['HTMLPurifierTest']['Net_IDNA2']) {
|
||||||
|
require_once 'Net/IDNA2.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Shell-script code is executed
|
// Shell-script code is executed
|
||||||
|
|
||||||
if ($AC['xml']) {
|
if ($AC['xml']) {
|
||||||
|
@ -51,9 +51,11 @@ $AC['standalone'] = false; // convenience for --distro=standalone
|
|||||||
$AC['only-phpt'] = false; // --type=phpt
|
$AC['only-phpt'] = false; // --type=phpt
|
||||||
$AC['exclude-normal'] = false; // --distro=standalone
|
$AC['exclude-normal'] = false; // --distro=standalone
|
||||||
$AC['exclude-standalone'] = false; // --distro=normal
|
$AC['exclude-standalone'] = false; // --distro=normal
|
||||||
|
$AC['verbose'] = false;
|
||||||
$aliases = array(
|
$aliases = array(
|
||||||
'f' => 'file',
|
'f' => 'file',
|
||||||
'q' => 'quiet',
|
'q' => 'quiet',
|
||||||
|
'v' => 'verbose',
|
||||||
);
|
);
|
||||||
htmlpurifier_parse_args($AC, $aliases);
|
htmlpurifier_parse_args($AC, $aliases);
|
||||||
|
|
||||||
@ -68,7 +70,7 @@ elseif ($AC['standalone']) $AC['distro'] = 'standalone';
|
|||||||
if ($AC['xml']) {
|
if ($AC['xml']) {
|
||||||
$reporter = new XmlReporter();
|
$reporter = new XmlReporter();
|
||||||
} else {
|
} else {
|
||||||
$reporter = new TextReporter();
|
$reporter = new HTMLPurifier_SimpleTest_TextReporter($AC);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regenerate any necessary files
|
// Regenerate any necessary files
|
||||||
|
Loading…
Reference in New Issue
Block a user