mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-22 08:21:52 +00:00
[1.4.0] Added convenient single test selector form on test runner
- Also fixed includes in test files - Updated TODO with CSS plans git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@659 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
0dd866cc15
commit
9b375fdfb8
1
NEWS
1
NEWS
@ -19,6 +19,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
||||
! Added %Core.EscapeNonASCIICharacters to workaround loss of Unicode
|
||||
characters while %Core.Encoding is set to a non-UTF-8 encoding.
|
||||
. Implemented AttrDef_CSSURI for url(http://google.com) style declarations
|
||||
. Added convenient single test selector form on test runner
|
||||
|
||||
1.3.3, unknown release date, likely to be dropped
|
||||
! Moved SLOW to docs/enduser-slow.html and added code examples
|
||||
|
2
TODO
2
TODO
@ -36,6 +36,8 @@ TODO List
|
||||
- Friendly strict handling of <address> (block -> <br>)
|
||||
|
||||
2.0 release
|
||||
# Legit token based CSS parsing (will require revamping almost every
|
||||
AttrDef class)
|
||||
# Formatters for plaintext (COMPLEX)
|
||||
- Auto-paragraphing (be sure to leverage fact that we know when things
|
||||
shouldn't be paragraphed, such as lists and tables).
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDef/Border.php';
|
||||
require_once 'HTMLPurifier/AttrDef/PixelsTest.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_BorderTest extends HTMLPurifier_AttrDef_PixelsTest
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDef/CSSLength.php';
|
||||
require_once 'HTMLPurifier/AttrDefHarness.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_CSSLengthTest extends HTMLPurifier_AttrDefHarness
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDef/Color.php';
|
||||
require_once 'HTMLPurifier/AttrDefHarness.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_ColorTest extends HTMLPurifier_AttrDefHarness
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDef/Composite.php';
|
||||
require_once 'HTMLPurifier/AttrDefHarness.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_Composite_Testable extends
|
||||
HTMLPurifier_AttrDef_Composite
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDef/Email.php';
|
||||
require_once 'HTMLPurifier/AttrDefHarness.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_EmailHarness extends HTMLPurifier_AttrDefHarness
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDef/Integer.php';
|
||||
require_once 'HTMLPurifier/AttrDefHarness.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_IntegerTest extends HTMLPurifier_AttrDefHarness
|
||||
{
|
||||
|
@ -1,7 +1,10 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDef/Integer.php';
|
||||
require_once 'HTMLPurifier/AttrDef/Multiple.php';
|
||||
require_once 'HTMLPurifier/AttrDefHarness.php';
|
||||
|
||||
// borrowed for the sakes of this test
|
||||
require_once 'HTMLPurifier/AttrDef/Integer.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_MultipleTest extends HTMLPurifier_AttrDefHarness
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDef/Number.php';
|
||||
require_once 'HTMLPurifier/AttrDefHarness.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_NumberTest extends HTMLPurifier_AttrDefHarness
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDef/Percentage.php';
|
||||
require_once 'HTMLPurifier/AttrDefHarness.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_PercentageTest extends HTMLPurifier_AttrDefHarness
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrTransform/BdoDir.php';
|
||||
require_once 'HTMLPurifier/AttrTransformHarness.php';
|
||||
|
||||
class HTMLPurifier_AttrTransform_BdoDirTest extends HTMLPurifier_AttrTransformHarness
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrTransform/ImgRequired.php';
|
||||
require_once 'HTMLPurifier/AttrTransformHarness.php';
|
||||
|
||||
class HTMLPurifier_AttrTransform_ImgRequiredTest extends HTMLPurifier_AttrTransformHarness
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrTransform/TextAlign.php';
|
||||
require_once 'HTMLPurifier/AttrTransformHarness.php';
|
||||
|
||||
class HTMLPurifier_AttrTransform_TextAlignTest extends HTMLPurifier_AttrTransformHarness
|
||||
{
|
||||
|
@ -8,6 +8,8 @@ error_reporting(E_ALL);
|
||||
// wishlist: automated calling of this file from multiple PHP versions so we
|
||||
// don't have to constantly switch around
|
||||
|
||||
$GLOBALS['HTMLPurifierTest'] = array();
|
||||
|
||||
// configuration
|
||||
$GLOBALS['HTMLPurifierTest']['PEAR'] = false; // do PEAR tests
|
||||
|
||||
@ -106,6 +108,9 @@ if (version_compare(PHP_VERSION, '5', '>=')) {
|
||||
$test_files[] = 'TokenFactoryTest.php';
|
||||
}
|
||||
|
||||
sort($test_files);
|
||||
$GLOBALS['HTMLPurifierTest']['Files'] = $test_files;
|
||||
|
||||
$test_file_lookup = array_flip($test_files);
|
||||
|
||||
function htmlpurifier_path2class($path) {
|
||||
@ -119,12 +124,48 @@ function htmlpurifier_path2class($path) {
|
||||
return $temp;
|
||||
}
|
||||
|
||||
// we can't use addTestFile because SimpleTest chokes on E_STRICT warnings
|
||||
// use a customized reporter with some helpful UI widgets
|
||||
|
||||
if (isset($_GET['f']) && isset($test_file_lookup[$_GET['f']])) {
|
||||
$GLOBALS['HTMLPurifierTest']['File'] = $_GET['f'];
|
||||
} else {
|
||||
$GLOBALS['HTMLPurifierTest']['File'] = false;
|
||||
}
|
||||
|
||||
class HTMLPurifier_SimpleTest_Reporter extends HTMLReporter
|
||||
{
|
||||
|
||||
// execute only one test
|
||||
$test_file = $_GET['f'];
|
||||
function paintHeader($test_name) {
|
||||
parent::paintHeader($test_name);
|
||||
$test_file = $GLOBALS['HTMLPurifierTest']['File'];
|
||||
?>
|
||||
<form action="" method="get" id="select">
|
||||
<select name="f">
|
||||
<option value="" style="font-weight:bold;"<?php if(!$test_file) {echo ' selected';} ?>>All Tests</option>
|
||||
<?php foreach($GLOBALS['HTMLPurifierTest']['Files'] as $file) { ?>
|
||||
<option value="<?php echo $file ?>"<?php
|
||||
if ($test_file == $file) echo ' selected';
|
||||
?>><?php echo $file ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<input type="submit" value="Go">
|
||||
</form>
|
||||
<?php
|
||||
flush();
|
||||
}
|
||||
|
||||
function _getCss() {
|
||||
$css = parent::_getCss();
|
||||
$css .= '
|
||||
#select {position:absolute;top:0.2em;right:0.2em;}
|
||||
';
|
||||
return $css;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// we can't use addTestFile because SimpleTest chokes on E_STRICT warnings
|
||||
if ($test_file = $GLOBALS['HTMLPurifierTest']['File']) {
|
||||
|
||||
$test = new GroupTest($test_file . ' - HTML Purifier');
|
||||
$path = 'HTMLPurifier/' . $test_file;
|
||||
@ -144,7 +185,7 @@ if (isset($_GET['f']) && isset($test_file_lookup[$_GET['f']])) {
|
||||
}
|
||||
|
||||
if (SimpleReporter::inCli()) $reporter = new TextReporter();
|
||||
else $reporter = new HTMLReporter('UTF-8');
|
||||
else $reporter = new HTMLPurifier_SimpleTest_Reporter('UTF-8');
|
||||
|
||||
$test->run($reporter);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user