mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-10-29 11:16:18 +01:00
Merge in r657-674, prompted by near release of 1.4.0.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/branches/strict@675 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
71
tests/HTMLPurifier/AttrDef/BackgroundPositionTest.php
Normal file
71
tests/HTMLPurifier/AttrDef/BackgroundPositionTest.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDefHarness.php';
|
||||
require_once 'HTMLPurifier/AttrDef/BackgroundPosition.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_BackgroundPositionTest extends HTMLPurifier_AttrDefHarness
|
||||
{
|
||||
|
||||
function test() {
|
||||
|
||||
$this->def = new HTMLPurifier_AttrDef_BackgroundPosition();
|
||||
|
||||
// explicitly cited in spec
|
||||
$this->assertDef('0% 0%');
|
||||
$this->assertDef('100% 100%');
|
||||
$this->assertDef('14% 84%');
|
||||
$this->assertDef('2cm 1cm');
|
||||
$this->assertDef('top');
|
||||
$this->assertDef('left');
|
||||
$this->assertDef('center');
|
||||
$this->assertDef('right');
|
||||
$this->assertDef('bottom');
|
||||
$this->assertDef('left top');
|
||||
$this->assertDef('center top');
|
||||
$this->assertDef('right top');
|
||||
$this->assertDef('left center');
|
||||
$this->assertDef('right center');
|
||||
$this->assertDef('left bottom');
|
||||
$this->assertDef('center bottom');
|
||||
$this->assertDef('right bottom');
|
||||
|
||||
// reordered due to internal impl details
|
||||
$this->assertDef('top left', 'left top');
|
||||
$this->assertDef('top center', 'center top');
|
||||
$this->assertDef('top right', 'right top');
|
||||
$this->assertDef('center left', 'left center');
|
||||
$this->assertDef('center center', 'center'); // two centers collide
|
||||
$this->assertDef('center right', 'right center');
|
||||
$this->assertDef('bottom left', 'left bottom');
|
||||
$this->assertDef('bottom center', 'center bottom');
|
||||
$this->assertDef('bottom right', 'right bottom');
|
||||
|
||||
// more cases from the defined syntax
|
||||
$this->assertDef('1.32in 4ex');
|
||||
$this->assertDef('-14% -84.65%');
|
||||
$this->assertDef('-1in -4ex');
|
||||
$this->assertDef('-1pc 2.3%');
|
||||
|
||||
// keyword mixing
|
||||
$this->assertDef('3em top');
|
||||
$this->assertDef('left 50%');
|
||||
|
||||
// fixable keyword mixing
|
||||
$this->assertDef('top 3em', '3em top');
|
||||
$this->assertDef('50% left', 'left 50%');
|
||||
|
||||
// whitespace collapsing
|
||||
$this->assertDef('3em top', '3em top');
|
||||
$this->assertDef("left\n \t foo ", 'left');
|
||||
|
||||
// invalid uses (we're going to be strict on these)
|
||||
$this->assertDef('foo bar', false);
|
||||
$this->assertDef('left left', 'left');
|
||||
$this->assertDef('left right top bottom center left', 'left bottom');
|
||||
$this->assertDef('0fr 9%', '9%');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
21
tests/HTMLPurifier/AttrDef/BackgroundTest.php
Normal file
21
tests/HTMLPurifier/AttrDef/BackgroundTest.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDefHarness.php';
|
||||
require_once 'HTMLPurifier/AttrDef/Background.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_BackgroundTest extends HTMLPurifier_AttrDefHarness
|
||||
{
|
||||
|
||||
function test() {
|
||||
|
||||
$this->def = new HTMLPurifier_AttrDef_Background(HTMLPurifier_Config::createDefault());
|
||||
|
||||
$valid = '#333 url(chess.png) repeat fixed 50% top';
|
||||
$this->assertDef($valid);
|
||||
$this->assertDef('url("chess.png") #333 50% top repeat fixed', $valid);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -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
|
||||
{
|
||||
@@ -21,6 +22,8 @@ class HTMLPurifier_AttrDef_CSSLengthTest extends HTMLPurifier_AttrDefHarness
|
||||
$this->assertDef('3pt');
|
||||
$this->assertDef('3pc');
|
||||
|
||||
$this->assertDef('3PX', '3px');
|
||||
|
||||
$this->assertDef('3', false);
|
||||
$this->assertDef('3miles', false);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
|
||||
$this->assertDef('text-transform:capitalize;');
|
||||
$this->assertDef('background-color:rgb(0,0,255);');
|
||||
$this->assertDef('background-color:transparent;');
|
||||
$this->assertDef('background:#FF9;');
|
||||
$this->assertDef('background:#333 url(chess.png) repeat fixed 50% top;');
|
||||
$this->assertDef('color:#F00;');
|
||||
$this->assertDef('border-top-color:#F00;');
|
||||
$this->assertDef('border-color:#F00 #FF0;');
|
||||
@@ -78,6 +78,7 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
|
||||
$this->assertDef('background-image:none;');
|
||||
$this->assertDef('background-repeat:repeat-y;');
|
||||
$this->assertDef('background-attachment:fixed;');
|
||||
$this->assertDef('background-position:left 90%;');
|
||||
|
||||
// duplicates
|
||||
$this->assertDef('text-align:right;text-align:left;',
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -66,13 +66,11 @@ class HTMLPurifier_AttrDef_IDTest extends HTMLPurifier_AttrDefHarness
|
||||
$this->assertDef('user_story95_alas');
|
||||
$this->assertDef('user_alas', 'user_story95_user_alas'); // !
|
||||
|
||||
// no effect when IDPrefix isn't set
|
||||
$this->config->set('Attr', 'IDPrefix', '');
|
||||
$this->assertDef('amherst'); // no affect when IDPrefix isn't set
|
||||
$this->assertError('%Attr.IDPrefixLocal cannot be used unless '.
|
||||
$this->expectError('%Attr.IDPrefixLocal cannot be used unless '.
|
||||
'%Attr.IDPrefix is set');
|
||||
// SimpleTest has a bug and throws a sprintf error
|
||||
// $this->assertNoErrors();
|
||||
$this->swallowErrors();
|
||||
$this->assertDef('amherst');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -38,10 +38,9 @@ extends HTMLPurifier_ChildDefHarness
|
||||
$this->assertResult('Needs wrap', '<div>Needs wrap</div>',
|
||||
array('HTML.BlockWrapper' => 'div'));
|
||||
|
||||
$this->expectError('Cannot use non-block element as block wrapper.');
|
||||
$this->assertResult('Needs wrap', '<p>Needs wrap</p>',
|
||||
array('HTML.BlockWrapper' => 'dav'));
|
||||
$this->assertError('Cannot use non-block element as block wrapper.');
|
||||
$this->assertNoErrors();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,26 @@
|
||||
|
||||
require_once 'HTMLPurifier/ConfigSchema.php';
|
||||
|
||||
if (!class_exists('CS')) {
|
||||
class CS extends HTMLPurifier_ConfigSchema {}
|
||||
}
|
||||
|
||||
class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Munged name of current file.
|
||||
*/
|
||||
var $file;
|
||||
|
||||
/**
|
||||
* Copy of the real ConfigSchema to revert to.
|
||||
*/
|
||||
var $old_copy;
|
||||
|
||||
/**
|
||||
* Copy of dummy ConfigSchema for testing purposes.
|
||||
*/
|
||||
var $our_copy;
|
||||
|
||||
function setUp() {
|
||||
@@ -18,239 +34,214 @@ class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
|
||||
$this->old_copy = HTMLPurifier_ConfigSchema::instance();
|
||||
// put in our copy, and reassign to the REAL reference
|
||||
$this->our_copy =& HTMLPurifier_ConfigSchema::instance($our_copy);
|
||||
|
||||
$this->file = $this->our_copy->mungeFilename(__FILE__);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
// testing is done, restore the old copy
|
||||
HTMLPurifier_ConfigSchema::instance($this->old_copy);
|
||||
tally_errors();
|
||||
}
|
||||
|
||||
function testNormal() {
|
||||
function test_defineNamespace() {
|
||||
CS::defineNamespace('http', $d = 'This is an internet protocol.');
|
||||
|
||||
$file = $this->our_copy->mungeFilename(__FILE__);
|
||||
|
||||
// define a namespace
|
||||
$description = 'Configuration that is always available.';
|
||||
HTMLPurifier_ConfigSchema::defineNamespace(
|
||||
'Core', $description
|
||||
);
|
||||
$this->assertIdentical($this->our_copy->defaults, array(
|
||||
'Core' => array()
|
||||
));
|
||||
$this->assertIdentical($this->our_copy->info, array(
|
||||
'Core' => array()
|
||||
));
|
||||
$namespace = new HTMLPurifier_ConfigEntity_Namespace();
|
||||
$namespace->description = $description;
|
||||
$this->assertIdentical($this->our_copy->info_namespace, array(
|
||||
'Core' => $namespace
|
||||
'http' => new HTMLPurifier_ConfigEntity_Namespace($d)
|
||||
));
|
||||
|
||||
$this->expectError('Cannot redefine namespace');
|
||||
CS::defineNamespace('http', 'It is used to serve webpages.');
|
||||
|
||||
$this->expectError('Namespace name must be alphanumeric');
|
||||
CS::defineNamespace('ssh+http', 'This http is tunneled through SSH.');
|
||||
|
||||
// define a directive
|
||||
$description = 'This is a description of the directive.';
|
||||
HTMLPurifier_ConfigSchema::define(
|
||||
'Core', 'Name', 'default value', 'string',
|
||||
$description
|
||||
); $line = __LINE__;
|
||||
$this->assertIdentical($this->our_copy->defaults, array(
|
||||
'Core' => array(
|
||||
'Name' => 'default value'
|
||||
)
|
||||
));
|
||||
$directive = new HTMLPurifier_ConfigEntity_Directive();
|
||||
$directive->type = 'string';
|
||||
$directive->addDescription($file, $line, $description);
|
||||
$this->assertIdentical($this->our_copy->info, array(
|
||||
'Core' => array(
|
||||
'Name' => $directive
|
||||
)
|
||||
));
|
||||
$this->expectError('Description must be non-empty');
|
||||
CS::defineNamespace('ftp', null);
|
||||
}
|
||||
|
||||
function test_define() {
|
||||
CS::defineNamespace('Car', 'Automobiles, those gas-guzzlers!');
|
||||
|
||||
CS::define('Car', 'Seats', 5, 'int', $d = 'Standard issue.'); $l = __LINE__;
|
||||
|
||||
|
||||
// define a directive in an undefined namespace
|
||||
HTMLPurifier_ConfigSchema::define(
|
||||
'Extension', 'Name', false, 'bool',
|
||||
'This is for an extension, but we have not defined its namespace!'
|
||||
);
|
||||
$this->assertError('Cannot define directive for undefined namespace');
|
||||
$this->assertNoErrors();
|
||||
|
||||
|
||||
|
||||
// redefine a value in a valid manner
|
||||
$description = 'Alternative configuration definition';
|
||||
HTMLPurifier_ConfigSchema::define(
|
||||
'Core', 'Name', 'default value', 'string',
|
||||
$description
|
||||
); $line = __LINE__;
|
||||
$this->assertNoErrors();
|
||||
$directive->addDescription($file, $line, $description);
|
||||
$this->assertIdentical($this->our_copy->info, array(
|
||||
'Core' => array(
|
||||
'Name' => $directive
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
|
||||
// redefine a directive in an invalid manner
|
||||
HTMLPurifier_ConfigSchema::define(
|
||||
'Core', 'Name', 'different default', 'string',
|
||||
'Inconsistent default or type, cannot redefine'
|
||||
);
|
||||
$this->assertError('Inconsistent default or type, cannot redefine');
|
||||
$this->assertNoErrors();
|
||||
|
||||
|
||||
|
||||
// make an enumeration
|
||||
HTMLPurifier_ConfigSchema::defineAllowedValues(
|
||||
'Core', 'Name', array(
|
||||
'Real Value',
|
||||
'Real Value 2'
|
||||
$this->assertIdentical($this->our_copy->defaults['Car']['Seats'], 5);
|
||||
$this->assertIdentical($this->our_copy->info['Car']['Seats'],
|
||||
new HTMLPurifier_ConfigEntity_Directive('int',
|
||||
array($this->file => array($l => $d))
|
||||
)
|
||||
);
|
||||
$directive->allowed = array(
|
||||
'Real Value' => true,
|
||||
'Real Value 2' => true
|
||||
);
|
||||
$this->assertIdentical($this->our_copy->info, array(
|
||||
'Core' => array(
|
||||
'Name' => $directive
|
||||
)
|
||||
));
|
||||
|
||||
CS::define('Car', 'Age', null, 'int/null', $d = 'Not always known.'); $l = __LINE__;
|
||||
|
||||
|
||||
// redefinition of enumeration is cumulative
|
||||
HTMLPurifier_ConfigSchema::defineAllowedValues(
|
||||
'Core', 'Name', array(
|
||||
'Real Value 3',
|
||||
$this->assertIdentical($this->our_copy->defaults['Car']['Age'], null);
|
||||
$this->assertIdentical($this->our_copy->info['Car']['Age'],
|
||||
new HTMLPurifier_ConfigEntity_Directive('int',
|
||||
array($this->file => array($l => $d)), true
|
||||
)
|
||||
);
|
||||
$directive->allowed['Real Value 3'] = true;
|
||||
$this->assertIdentical($this->our_copy->info, array(
|
||||
'Core' => array(
|
||||
'Name' => $directive
|
||||
)
|
||||
));
|
||||
|
||||
$this->expectError('Cannot define directive for undefined namespace');
|
||||
CS::define('Train', 'Cars', 10, 'int', 'Including the caboose.');
|
||||
|
||||
$this->expectError('Directive name must be alphanumeric');
|
||||
CS::define('Car', 'Is it shiny?', true, 'bool', 'Indicates regular waxing.');
|
||||
|
||||
// cannot define enumeration for undefined directive
|
||||
HTMLPurifier_ConfigSchema::defineAllowedValues(
|
||||
'Core', 'Foobar', array(
|
||||
'Real Value 9',
|
||||
$this->expectError('Invalid type for configuration directive');
|
||||
CS::define('Car', 'Efficiency', 50, 'mpg', 'The higher the better.');
|
||||
|
||||
$this->expectError('Default value does not match directive type');
|
||||
CS::define('Car', 'Producer', 'Ford', 'int', 'ID of the company that made the car.');
|
||||
|
||||
$this->expectError('Description must be non-empty');
|
||||
CS::define('Car', 'ComplexAttribute', 'lawyers', 'istring', null);
|
||||
}
|
||||
|
||||
function testRedefinition_define() {
|
||||
CS::defineNamespace('Cat', 'Belongs to Schrodinger.');
|
||||
|
||||
CS::define('Cat', 'Dead', false, 'bool', $d1 = 'Well, is it?'); $l1 = __LINE__;
|
||||
CS::define('Cat', 'Dead', false, 'bool', $d2 = 'It is difficult to say.'); $l2 = __LINE__;
|
||||
|
||||
$this->assertIdentical($this->our_copy->defaults['Cat']['Dead'], false);
|
||||
$this->assertIdentical($this->our_copy->info['Cat']['Dead'],
|
||||
new HTMLPurifier_ConfigEntity_Directive('bool',
|
||||
array($this->file => array($l1 => $d1, $l2 => $d2))
|
||||
)
|
||||
);
|
||||
$this->assertError('Cannot define allowed values for undefined directive');
|
||||
$this->assertNoErrors();
|
||||
|
||||
$this->expectError('Inconsistent default or type, cannot redefine');
|
||||
CS::define('Cat', 'Dead', true, 'bool', 'Quantum mechanics does not know.');
|
||||
|
||||
$this->expectError('Inconsistent default or type, cannot redefine');
|
||||
CS::define('Cat', 'Dead', 'maybe', 'string', 'Perhaps if we look we will know.');
|
||||
}
|
||||
|
||||
function test_defineAllowedValues() {
|
||||
CS::defineNamespace('QuantumNumber', 'D');
|
||||
CS::define('QuantumNumber', 'Spin', 0.5, 'float',
|
||||
'Spin of particle. Fourth quantum number, represented by s.');
|
||||
CS::define('QuantumNumber', 'Current', 's', 'string',
|
||||
'Currently selected quantum number.');
|
||||
CS::define('QuantumNumber', 'Difficulty', null, 'string/null', $d = 'How hard are the problems?'); $l = __LINE__;
|
||||
|
||||
// test defining value aliases for an enumerated value
|
||||
HTMLPurifier_ConfigSchema::defineValueAliases(
|
||||
'Core', 'Name', array(
|
||||
'Aliased Value' => 'Real Value'
|
||||
CS::defineAllowedValues( // okay, since default is null
|
||||
'QuantumNumber', 'Difficulty', array('easy', 'medium', 'hard')
|
||||
);
|
||||
|
||||
$this->assertIdentical($this->our_copy->defaults['QuantumNumber']['Difficulty'], null);
|
||||
$this->assertIdentical($this->our_copy->info['QuantumNumber']['Difficulty'],
|
||||
new HTMLPurifier_ConfigEntity_Directive(
|
||||
'string',
|
||||
array($this->file => array($l => $d)),
|
||||
true,
|
||||
array(
|
||||
'easy' => true,
|
||||
'medium' => true,
|
||||
'hard' => true
|
||||
)
|
||||
)
|
||||
);
|
||||
$directive->aliases['Aliased Value'] = 'Real Value';
|
||||
$this->assertIdentical($this->our_copy->info, array(
|
||||
'Core' => array(
|
||||
'Name' => $directive
|
||||
)
|
||||
));
|
||||
|
||||
$this->expectError('Cannot define allowed values for undefined directive');
|
||||
CS::defineAllowedValues(
|
||||
'SpaceTime', 'Symmetry', array('time', 'spatial', 'projective')
|
||||
);
|
||||
|
||||
$this->expectError('Cannot define allowed values for directive whose type is not string');
|
||||
CS::defineAllowedValues(
|
||||
'QuantumNumber', 'Spin', array(0.5, -0.5)
|
||||
);
|
||||
|
||||
// redefine should be cumulative
|
||||
HTMLPurifier_ConfigSchema::defineValueAliases(
|
||||
'Core', 'Name', array(
|
||||
'Aliased Value 2' => 'Real Value 2'
|
||||
$this->expectError('Default value must be in allowed range of variables');
|
||||
CS::defineAllowedValues(
|
||||
'QuantumNumber', 'Current', array('n', 'l', 'm') // forgot s!
|
||||
);
|
||||
}
|
||||
|
||||
function test_defineValueAliases() {
|
||||
CS::defineNamespace('Abbrev', 'Stuff on abbreviations.');
|
||||
CS::define('Abbrev', 'HTH', 'Happy to Help', 'string', $d = 'Three-letters'); $l = __LINE__;
|
||||
CS::defineAllowedValues(
|
||||
'Abbrev', 'HTH', array(
|
||||
'Happy to Help',
|
||||
'Hope that Helps',
|
||||
'HAIL THE HAND!'
|
||||
)
|
||||
);
|
||||
$directive->aliases['Aliased Value 2'] = 'Real Value 2';
|
||||
$this->assertIdentical($this->our_copy->info, array(
|
||||
'Core' => array(
|
||||
'Name' => $directive
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
|
||||
// cannot create alias to not-allowed value
|
||||
HTMLPurifier_ConfigSchema::defineValueAliases(
|
||||
'Core', 'Name', array(
|
||||
'Aliased Value 3' => 'Invalid Value'
|
||||
CS::defineValueAliases(
|
||||
'Abbrev', 'HTH', array(
|
||||
'happy' => 'Happy to Help',
|
||||
'hope' => 'Hope that Helps'
|
||||
)
|
||||
);
|
||||
$this->assertError('Cannot define alias to value that is not allowed');
|
||||
$this->assertNoErrors();
|
||||
|
||||
|
||||
|
||||
// cannot create alias for already allowed value
|
||||
HTMLPurifier_ConfigSchema::defineValueAliases(
|
||||
'Core', 'Name', array(
|
||||
'Real Value' => 'Real Value 2'
|
||||
CS::defineValueAliases( // delayed addition
|
||||
'Abbrev', 'HTH', array(
|
||||
'hail' => 'HAIL THE HAND!'
|
||||
)
|
||||
);
|
||||
$this->assertError('Cannot define alias over allowed value');
|
||||
$this->assertNoErrors();
|
||||
|
||||
|
||||
|
||||
// define a directive with an invalid type
|
||||
HTMLPurifier_ConfigSchema::define(
|
||||
'Core', 'Foobar', false, 'omen',
|
||||
'Omen is not a valid type, so we reject this.'
|
||||
$this->assertIdentical($this->our_copy->defaults['Abbrev']['HTH'], 'Happy to Help');
|
||||
$this->assertIdentical($this->our_copy->info['Abbrev']['HTH'],
|
||||
new HTMLPurifier_ConfigEntity_Directive(
|
||||
'string',
|
||||
array($this->file => array($l => $d)),
|
||||
false,
|
||||
array(
|
||||
'Happy to Help' => true,
|
||||
'Hope that Helps' => true,
|
||||
'HAIL THE HAND!' => true
|
||||
),
|
||||
array(
|
||||
'happy' => 'Happy to Help',
|
||||
'hope' => 'Hope that Helps',
|
||||
'hail' => 'HAIL THE HAND!'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertError('Invalid type for configuration directive');
|
||||
$this->assertNoErrors();
|
||||
|
||||
|
||||
|
||||
// define a directive with inconsistent type
|
||||
HTMLPurifier_ConfigSchema::define(
|
||||
'Core', 'Foobaz', 10, 'string',
|
||||
'If we say string, we should mean it, not integer 10.'
|
||||
$this->expectError('Cannot define alias to value that is not allowed');
|
||||
CS::defineValueAliases(
|
||||
'Abbrev', 'HTH', array(
|
||||
'head' => 'Head to Head'
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertError('Default value does not match directive type');
|
||||
$this->assertNoErrors();
|
||||
|
||||
|
||||
|
||||
// define a directive that allows null
|
||||
HTMLPurifier_ConfigSchema::define(
|
||||
'Core', 'Foobaz', null, 'string/null',
|
||||
'Nulls are allowed if you add on /null, cool huh?'
|
||||
$this->expectError('Cannot define alias over allowed value');
|
||||
CS::defineValueAliases(
|
||||
'Abbrev', 'HTH', array(
|
||||
'Hope that Helps' => 'Happy to Help'
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertNoErrors();
|
||||
}
|
||||
|
||||
function testAlias() {
|
||||
CS::defineNamespace('Home', 'Sweet home.');
|
||||
CS::define('Home', 'Rug', 3, 'int', 'ID.');
|
||||
CS::defineAlias('Home', 'Carpet', 'Home', 'Rug');
|
||||
|
||||
|
||||
// define a directive with bad characters
|
||||
HTMLPurifier_ConfigSchema::define(
|
||||
'Core', 'Core.Attr', 10, 'int',
|
||||
'No periods! >:-('
|
||||
$this->assertTrue(!isset($this->our_copy->defaults['Home']['Carpet']));
|
||||
$this->assertIdentical($this->our_copy->info['Home']['Carpet'],
|
||||
new HTMLPurifier_ConfigEntity_DirectiveAlias('Home', 'Rug')
|
||||
);
|
||||
|
||||
$this->assertError('Directive name must be alphanumeric');
|
||||
$this->assertNoErrors();
|
||||
$this->expectError('Cannot define directive alias in undefined namespace');
|
||||
CS::defineAlias('Store', 'Rug', 'Home', 'Rug');
|
||||
|
||||
// define a namespace with bad characters
|
||||
HTMLPurifier_ConfigSchema::defineNamespace(
|
||||
'Foobar&Gromit', $description
|
||||
);
|
||||
$this->expectError('Directive name must be alphanumeric');
|
||||
CS::defineAlias('Home', 'R.g', 'Home', 'Rug');
|
||||
|
||||
$this->assertError('Namespace name must be alphanumeric');
|
||||
$this->assertNoErrors();
|
||||
CS::define('Home', 'Rugger', 'Bob Max', 'string', 'Name of.');
|
||||
$this->expectError('Cannot define alias over directive');
|
||||
CS::defineAlias('Home', 'Rugger', 'Home', 'Rug');
|
||||
|
||||
$this->expectError('Cannot define alias to undefined directive');
|
||||
CS::defineAlias('Home', 'Rug2', 'Home', 'Rugavan');
|
||||
|
||||
$this->expectError('Cannot define alias to alias');
|
||||
CS::defineAlias('Home', 'Rug2', 'Home', 'Carpet');
|
||||
}
|
||||
|
||||
function assertValid($var, $type, $ret = null) {
|
||||
@@ -270,25 +261,32 @@ class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
|
||||
|
||||
$this->assertValid('foobar', 'string');
|
||||
$this->assertValid('FOOBAR', 'istring', 'foobar');
|
||||
|
||||
$this->assertValid(34, 'int');
|
||||
|
||||
$this->assertValid(3.34, 'float');
|
||||
|
||||
$this->assertValid(false, 'bool');
|
||||
$this->assertValid(0, 'bool', false);
|
||||
$this->assertValid(1, 'bool', true);
|
||||
$this->assertInvalid(34, 'bool');
|
||||
$this->assertInvalid(null, 'bool');
|
||||
$this->assertValid(array('1', '2', '3'), 'list');
|
||||
$this->assertValid(array('1' => true, '2' => true), 'lookup');
|
||||
$this->assertValid(array('1', '2'), 'lookup', array('1' => true, '2' => true));
|
||||
$this->assertValid(array('foo' => 'bar'), 'hash');
|
||||
$this->assertInvalid(array(0 => 'moo'), 'hash');
|
||||
$this->assertValid(array(1 => 'moo'), 'hash');
|
||||
$this->assertValid(23, 'mixed');
|
||||
$this->assertValid('foo,bar, cow', 'list', array('foo', 'bar', 'cow'));
|
||||
$this->assertValid('foo,bar', 'lookup', array('foo' => true, 'bar' => true));
|
||||
$this->assertValid('true', 'bool', true);
|
||||
$this->assertValid('false', 'bool', false);
|
||||
$this->assertValid('1', 'bool', true);
|
||||
$this->assertInvalid(34, 'bool');
|
||||
$this->assertInvalid(null, 'bool');
|
||||
|
||||
$this->assertValid(array('1', '2', '3'), 'list');
|
||||
$this->assertValid('foo,bar, cow', 'list', array('foo', 'bar', 'cow'));
|
||||
|
||||
$this->assertValid(array('1' => true, '2' => true), 'lookup');
|
||||
$this->assertValid(array('1', '2'), 'lookup', array('1' => true, '2' => true));
|
||||
$this->assertValid('foo,bar', 'lookup', array('foo' => true, 'bar' => true));
|
||||
|
||||
$this->assertValid(array('foo' => 'bar'), 'hash');
|
||||
$this->assertValid(array(1 => 'moo'), 'hash');
|
||||
$this->assertInvalid(array(0 => 'moo'), 'hash');
|
||||
|
||||
$this->assertValid(23, 'mixed');
|
||||
|
||||
}
|
||||
|
||||
@@ -318,12 +316,12 @@ class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
|
||||
function testMungeFilename() {
|
||||
|
||||
$this->assertMungeFilename(
|
||||
'C:\\php\\libs\\htmlpurifier\\library\\HTMLPurifier\\AttrDef.php',
|
||||
'C:\\php\\My Libraries\\htmlpurifier\\library\\HTMLPurifier\\AttrDef.php',
|
||||
'HTMLPurifier/AttrDef.php'
|
||||
);
|
||||
|
||||
$this->assertMungeFilename(
|
||||
'C:\\php\\libs\\htmlpurifier\\library\\HTMLPurifier.php',
|
||||
'C:\\php\\My Libraries\\htmlpurifier\\library\\HTMLPurifier.php',
|
||||
'HTMLPurifier.php'
|
||||
);
|
||||
|
||||
|
||||
2
tests/HTMLPurifier/ConfigTest-create.ini
Normal file
2
tests/HTMLPurifier/ConfigTest-create.ini
Normal file
@@ -0,0 +1,2 @@
|
||||
[Cake]
|
||||
Sprinkles = 42
|
||||
4
tests/HTMLPurifier/ConfigTest-loadIni.ini
Normal file
4
tests/HTMLPurifier/ConfigTest-loadIni.ini
Normal file
@@ -0,0 +1,4 @@
|
||||
[Shortcut]
|
||||
Copy = q
|
||||
Cut = t
|
||||
Paste = p
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
require_once 'HTMLPurifier/Config.php';
|
||||
|
||||
if (!class_exists('CS')) {
|
||||
class CS extends HTMLPurifier_ConfigSchema {}
|
||||
}
|
||||
|
||||
class HTMLPurifier_ConfigTest extends UnitTestCase
|
||||
{
|
||||
|
||||
@@ -16,109 +20,199 @@ class HTMLPurifier_ConfigTest extends UnitTestCase
|
||||
|
||||
function tearDown() {
|
||||
HTMLPurifier_ConfigSchema::instance($this->old_copy);
|
||||
tally_errors();
|
||||
}
|
||||
|
||||
function test() {
|
||||
// test functionality based on ConfigSchema
|
||||
|
||||
function testNormal() {
|
||||
CS::defineNamespace('Element', 'Chemical substances that cannot be further decomposed');
|
||||
|
||||
HTMLPurifier_ConfigSchema::defineNamespace('Core', 'Corestuff');
|
||||
HTMLPurifier_ConfigSchema::defineNamespace('Attr', 'Attributes');
|
||||
HTMLPurifier_ConfigSchema::defineNamespace('Extension', 'Extensible');
|
||||
|
||||
HTMLPurifier_ConfigSchema::define(
|
||||
'Core', 'Key', false, 'bool', 'A boolean directive.'
|
||||
);
|
||||
HTMLPurifier_ConfigSchema::define(
|
||||
'Attr', 'Key', 42, 'int', 'An integer directive.'
|
||||
);
|
||||
HTMLPurifier_ConfigSchema::define(
|
||||
'Extension', 'Pert', 'foo', 'string', 'A string directive.'
|
||||
);
|
||||
HTMLPurifier_ConfigSchema::define(
|
||||
'Core', 'Encoding', 'utf-8', 'istring', 'Case insensitivity!'
|
||||
);
|
||||
|
||||
HTMLPurifier_ConfigSchema::define(
|
||||
'Extension', 'CanBeNull', null, 'string/null', 'Null or string!'
|
||||
);
|
||||
|
||||
HTMLPurifier_ConfigSchema::defineAllowedValues(
|
||||
'Extension', 'Pert', array('foo', 'moo')
|
||||
);
|
||||
HTMLPurifier_ConfigSchema::defineValueAliases(
|
||||
'Extension', 'Pert', array('cow' => 'moo')
|
||||
);
|
||||
HTMLPurifier_ConfigSchema::defineAllowedValues(
|
||||
'Core', 'Encoding', array('utf-8', 'iso-8859-1')
|
||||
);
|
||||
CS::define('Element', 'Abbr', 'H', 'string', 'Abbreviation of element name.');
|
||||
CS::define('Element', 'Name', 'hydrogen', 'istring', 'Full name of atoms.');
|
||||
CS::define('Element', 'Number', 1, 'int', 'Atomic number, is identity.');
|
||||
CS::define('Element', 'Mass', 1.00794, 'float', 'Atomic mass.');
|
||||
CS::define('Element', 'Radioactive', false, 'bool', 'Does it have rapid decay?');
|
||||
CS::define('Element', 'Isotopes', array(1 => true, 2 => true, 3 => true), 'lookup',
|
||||
'What numbers of neutrons for this element have been observed?');
|
||||
CS::define('Element', 'Traits', array('nonmetallic', 'odorless', 'flammable'), 'list',
|
||||
'What are general properties of the element?');
|
||||
CS::define('Element', 'IsotopeNames', array(1 => 'protium', 2 => 'deuterium', 3 => 'tritium'), 'hash',
|
||||
'Lookup hash of neutron counts to formal names.');
|
||||
CS::define('Element', 'Object', new stdClass(), 'mixed', 'Model representation.');
|
||||
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
|
||||
// test default value retrieval
|
||||
$this->assertIdentical($config->get('Core', 'Key'), false);
|
||||
$this->assertIdentical($config->get('Attr', 'Key'), 42);
|
||||
$this->assertIdentical($config->get('Extension', 'Pert'), 'foo');
|
||||
$this->assertIdentical($config->get('Element', 'Abbr'), 'H');
|
||||
$this->assertIdentical($config->get('Element', 'Name'), 'hydrogen');
|
||||
$this->assertIdentical($config->get('Element', 'Number'), 1);
|
||||
$this->assertIdentical($config->get('Element', 'Mass'), 1.00794);
|
||||
$this->assertIdentical($config->get('Element', 'Radioactive'), false);
|
||||
$this->assertIdentical($config->get('Element', 'Isotopes'), array(1 => true, 2 => true, 3 => true));
|
||||
$this->assertIdentical($config->get('Element', 'Traits'), array('nonmetallic', 'odorless', 'flammable'));
|
||||
$this->assertIdentical($config->get('Element', 'IsotopeNames'), array(1 => 'protium', 2 => 'deuterium', 3 => 'tritium'));
|
||||
$this->assertIdentical($config->get('Element', 'Object'), new stdClass());
|
||||
|
||||
// set some values
|
||||
$config->set('Core', 'Key', true);
|
||||
$this->assertIdentical($config->get('Core', 'Key'), true);
|
||||
// test setting values
|
||||
$config->set('Element', 'Abbr', 'Pu');
|
||||
$config->set('Element', 'Name', 'PLUTONIUM'); // test decaps
|
||||
$config->set('Element', 'Number', '94'); // test parsing
|
||||
$config->set('Element', 'Mass', '244.'); // test parsing
|
||||
$config->set('Element', 'Radioactive', true);
|
||||
$config->set('Element', 'Isotopes', array(238, 239)); // test inversion
|
||||
$config->set('Element', 'Traits', 'nuclear, heavy, actinide'); // test parsing
|
||||
$config->set('Element', 'IsotopeNames', array(238 => 'Plutonium-238', 239 => 'Plutonium-239'));
|
||||
$config->set('Element', 'Object', false); // unmodeled
|
||||
|
||||
// try to retrieve undefined value
|
||||
$config->get('Core', 'NotDefined');
|
||||
$this->assertError('Cannot retrieve value of undefined directive');
|
||||
$this->assertNoErrors();
|
||||
// test value retrieval
|
||||
$this->assertIdentical($config->get('Element', 'Abbr'), 'Pu');
|
||||
$this->assertIdentical($config->get('Element', 'Name'), 'plutonium');
|
||||
$this->assertIdentical($config->get('Element', 'Number'), 94);
|
||||
$this->assertIdentical($config->get('Element', 'Mass'), 244.);
|
||||
$this->assertIdentical($config->get('Element', 'Radioactive'), true);
|
||||
$this->assertIdentical($config->get('Element', 'Isotopes'), array(238 => true, 239 => true));
|
||||
$this->assertIdentical($config->get('Element', 'Traits'), array('nuclear', 'heavy', 'actinide'));
|
||||
$this->assertIdentical($config->get('Element', 'IsotopeNames'), array(238 => 'Plutonium-238', 239 => 'Plutonium-239'));
|
||||
$this->assertIdentical($config->get('Element', 'Object'), false);
|
||||
|
||||
// try to set undefined value
|
||||
$config->set('Foobar', 'Key', 'foobar');
|
||||
$this->assertError('Cannot set undefined directive to value');
|
||||
$this->assertNoErrors();
|
||||
// errors
|
||||
|
||||
// try to set not allowed value
|
||||
$config->set('Extension', 'Pert', 'wizard');
|
||||
$this->assertError('Value not supported');
|
||||
$this->assertNoErrors();
|
||||
$this->expectError('Cannot retrieve value of undefined directive');
|
||||
$config->get('Element', 'Metal');
|
||||
|
||||
// try to set not allowed value
|
||||
$config->set('Extension', 'Pert', 34);
|
||||
$this->assertError('Value is of invalid type');
|
||||
$this->assertNoErrors();
|
||||
$this->expectError('Cannot set undefined directive to value');
|
||||
$config->set('Element', 'Metal', true);
|
||||
|
||||
// set aliased value
|
||||
$config->set('Extension', 'Pert', 'cow');
|
||||
$this->assertNoErrors();
|
||||
$this->assertIdentical($config->get('Extension', 'Pert'), 'moo');
|
||||
$this->expectError('Value is of invalid type');
|
||||
$config->set('Element', 'Radioactive', 'very');
|
||||
|
||||
// case-insensitive attempt to set value that is allowed
|
||||
$config->set('Core', 'Encoding', 'ISO-8859-1');
|
||||
$this->assertNoErrors();
|
||||
$this->assertIdentical($config->get('Core', 'Encoding'), 'iso-8859-1');
|
||||
}
|
||||
|
||||
function testEnumerated() {
|
||||
|
||||
// set null to directive that allows null
|
||||
$config->set('Extension', 'CanBeNull', null);
|
||||
$this->assertNoErrors();
|
||||
$this->assertIdentical($config->get('Extension', 'CanBeNull'), null);
|
||||
CS::defineNamespace('Instrument', 'Of the musical type.');
|
||||
|
||||
$config->set('Extension', 'CanBeNull', 'foobar');
|
||||
$this->assertNoErrors();
|
||||
$this->assertIdentical($config->get('Extension', 'CanBeNull'), 'foobar');
|
||||
// case sensitive
|
||||
CS::define('Instrument', 'Manufacturer', 'Yamaha', 'string', 'Who made it?');
|
||||
CS::defineAllowedValues('Instrument', 'Manufacturer', array(
|
||||
'Yamaha', 'Conn-Selmer', 'Vandoren', 'Laubin', 'Buffet', 'other'));
|
||||
CS::defineValueAliases('Instrument', 'Manufacturer', array(
|
||||
'Selmer' => 'Conn-Selmer'));
|
||||
|
||||
// set null to directive that doesn't allow null
|
||||
$config->set('Extension', 'Pert', null);
|
||||
$this->assertError('Value is of invalid type');
|
||||
$this->assertNoErrors();
|
||||
// case insensitive
|
||||
CS::define('Instrument', 'Family', 'woodwind', 'istring', 'What family is it?');
|
||||
CS::defineAllowedValues('Instrument', 'Family', array(
|
||||
'brass', 'woodwind', 'percussion', 'string', 'keyboard', 'electronic'));
|
||||
CS::defineValueAliases('Instrument', 'Family', array(
|
||||
'synth' => 'electronic'));
|
||||
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
|
||||
// case sensitive
|
||||
|
||||
$config->set('Instrument', 'Manufacturer', 'Vandoren');
|
||||
$this->assertIdentical($config->get('Instrument', 'Manufacturer'), 'Vandoren');
|
||||
|
||||
$config->set('Instrument', 'Manufacturer', 'Selmer');
|
||||
$this->assertIdentical($config->get('Instrument', 'Manufacturer'), 'Conn-Selmer');
|
||||
|
||||
$this->expectError('Value not supported');
|
||||
$config->set('Instrument', 'Manufacturer', 'buffet');
|
||||
|
||||
// case insensitive
|
||||
|
||||
$config->set('Instrument', 'Family', 'brass');
|
||||
$this->assertIdentical($config->get('Instrument', 'Family'), 'brass');
|
||||
|
||||
$config->set('Instrument', 'Family', 'PERCUSSION');
|
||||
$this->assertIdentical($config->get('Instrument', 'Family'), 'percussion');
|
||||
|
||||
$config->set('Instrument', 'Family', 'synth');
|
||||
$this->assertIdentical($config->get('Instrument', 'Family'), 'electronic');
|
||||
|
||||
$config->set('Instrument', 'Family', 'Synth');
|
||||
$this->assertIdentical($config->get('Instrument', 'Family'), 'electronic');
|
||||
|
||||
}
|
||||
|
||||
function testNull() {
|
||||
|
||||
CS::defineNamespace('ReportCard', 'It is for grades.');
|
||||
CS::define('ReportCard', 'English', null, 'string/null', 'Grade from English class.');
|
||||
CS::define('ReportCard', 'Absences', 0, 'int', 'How many times missing from school?');
|
||||
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
|
||||
$config->set('ReportCard', 'English', 'B-');
|
||||
$this->assertIdentical($config->get('ReportCard', 'English'), 'B-');
|
||||
|
||||
$config->set('ReportCard', 'English', null); // not yet graded
|
||||
$this->assertIdentical($config->get('ReportCard', 'English'), null);
|
||||
|
||||
// error
|
||||
$this->expectError('Value is of invalid type');
|
||||
$config->set('ReportCard', 'Absences', null);
|
||||
|
||||
}
|
||||
|
||||
function testAliases() {
|
||||
|
||||
HTMLPurifier_ConfigSchema::defineNamespace('Home', 'Sweet home.');
|
||||
HTMLPurifier_ConfigSchema::define('Home', 'Rug', 3, 'int', 'ID.');
|
||||
HTMLPurifier_ConfigSchema::defineAlias('Home', 'Carpet', 'Home', 'Rug');
|
||||
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
|
||||
$this->assertEqual($config->get('Home', 'Rug'), 3);
|
||||
|
||||
$this->expectError('Cannot get value from aliased directive, use real name');
|
||||
$config->get('Home', 'Carpet');
|
||||
|
||||
$config->set('Home', 'Carpet', 999);
|
||||
$this->assertEqual($config->get('Home', 'Rug'), 999);
|
||||
|
||||
}
|
||||
|
||||
// test functionality based on method
|
||||
|
||||
function test_getBatch() {
|
||||
|
||||
CS::defineNamespace('Variables', 'Changing quantities in equation.');
|
||||
CS::define('Variables', 'TangentialAcceleration', 'a_tan', 'string', 'In m/s^2');
|
||||
CS::define('Variables', 'AngularAcceleration', 'alpha', 'string', 'In rad/s^2');
|
||||
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
|
||||
// grab a namespace
|
||||
$config->set('Attr', 'Key', 0xBEEF);
|
||||
$this->assertIdentical(
|
||||
$config->getBatch('Attr'),
|
||||
$config->getBatch('Variables'),
|
||||
array(
|
||||
'Key' => 0xBEEF
|
||||
'TangentialAcceleration' => 'a_tan',
|
||||
'AngularAcceleration' => 'alpha'
|
||||
)
|
||||
);
|
||||
|
||||
// grab a non-existant namespace
|
||||
$config->getBatch('FurnishedGoods');
|
||||
$this->assertError('Cannot retrieve undefined namespace');
|
||||
$this->assertNoErrors();
|
||||
$this->expectError('Cannot retrieve undefined namespace');
|
||||
$config->getBatch('Constants');
|
||||
|
||||
}
|
||||
|
||||
function test_loadIni() {
|
||||
|
||||
CS::defineNamespace('Shortcut', 'Keyboard shortcuts for commands');
|
||||
CS::define('Shortcut', 'Copy', 'c', 'istring', 'Copy text');
|
||||
CS::define('Shortcut', 'Paste', 'v', 'istring', 'Paste clipboard');
|
||||
CS::define('Shortcut', 'Cut', 'x', 'istring', 'Cut text');
|
||||
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
|
||||
$config->loadIni(dirname(__FILE__) . '/ConfigTest-loadIni.ini');
|
||||
|
||||
$this->assertIdentical($config->get('Shortcut', 'Copy'), 'q');
|
||||
$this->assertIdentical($config->get('Shortcut', 'Paste'), 'p');
|
||||
$this->assertIdentical($config->get('Shortcut', 'Cut'), 't');
|
||||
|
||||
}
|
||||
|
||||
@@ -148,7 +242,7 @@ class HTMLPurifier_ConfigTest extends UnitTestCase
|
||||
'Zoo', 'Others', array(), 'list', 'Other animals we have one of.'
|
||||
);
|
||||
|
||||
$config_manual = HTMLPurifier_Config::createDefault();
|
||||
$config_manual = HTMLPurifier_Config::createDefault();
|
||||
$config_loadabbr = HTMLPurifier_Config::createDefault();
|
||||
$config_loadfull = HTMLPurifier_Config::createDefault();
|
||||
|
||||
@@ -197,6 +291,10 @@ class HTMLPurifier_ConfigTest extends UnitTestCase
|
||||
$created_config = HTMLPurifier_Config::create(array('Cake.Sprinkles' => 42));
|
||||
$this->assertEqual($config, $created_config);
|
||||
|
||||
// test loadIni
|
||||
$created_config = HTMLPurifier_Config::create(dirname(__FILE__) . '/ConfigTest-create.ini');
|
||||
$this->assertEqual($config, $created_config);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,12 +29,13 @@ class HTMLPurifier_ContextTest extends UnitTestCase
|
||||
|
||||
$this->context->destroy('IDAccumulator');
|
||||
$this->assertFalse($this->context->exists('IDAccumulator'));
|
||||
|
||||
$this->expectError('Attempted to retrieve non-existent variable');
|
||||
$accumulator_3 =& $this->context->get('IDAccumulator');
|
||||
$this->assertError('Attempted to retrieve non-existent variable');
|
||||
$this->assertNull($accumulator_3);
|
||||
|
||||
$this->expectError('Attempted to destroy non-existent variable');
|
||||
$this->context->destroy('IDAccumulator');
|
||||
$this->assertError('Attempted to destroy non-existent variable');
|
||||
|
||||
}
|
||||
|
||||
@@ -42,15 +43,13 @@ class HTMLPurifier_ContextTest extends UnitTestCase
|
||||
|
||||
$var = true;
|
||||
$this->context->register('OnceOnly', $var);
|
||||
$this->assertNoErrors();
|
||||
|
||||
$this->expectError('Name collision, cannot re-register');
|
||||
$this->context->register('OnceOnly', $var);
|
||||
$this->assertError('Name collision, cannot re-register');
|
||||
|
||||
// destroy it, now registration is okay
|
||||
$this->context->destroy('OnceOnly');
|
||||
$this->context->register('OnceOnly', $var);
|
||||
$this->assertNoErrors();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ require_once 'HTMLPurifier/Encoder.php';
|
||||
class HTMLPurifier_EncoderTest extends UnitTestCase
|
||||
{
|
||||
|
||||
var $Encoder;
|
||||
var $_entity_lookup;
|
||||
|
||||
function setUp() {
|
||||
$this->_entity_lookup = HTMLPurifier_EntityLookup::instance();
|
||||
@@ -60,6 +60,9 @@ class HTMLPurifier_EncoderTest extends UnitTestCase
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$context = new HTMLPurifier_Context();
|
||||
|
||||
// zhong-wen
|
||||
$chinese = "\xE4\xB8\xAD\xE6\x96\x87 (Chinese)";
|
||||
|
||||
// UTF-8 means that we don't touch it
|
||||
$this->assertIdentical(
|
||||
HTMLPurifier_Encoder::convertFromUTF8("\xC3\xB6", $config, $context),
|
||||
@@ -74,13 +77,55 @@ class HTMLPurifier_EncoderTest extends UnitTestCase
|
||||
"\xF6"
|
||||
);
|
||||
|
||||
$config->set('Test', 'ForceNoIconv', true);
|
||||
if (function_exists('iconv')) {
|
||||
// iconv has it's own way
|
||||
$this->assertIdentical(
|
||||
HTMLPurifier_Encoder::convertFromUTF8($chinese, $config, $context),
|
||||
" (Chinese)"
|
||||
);
|
||||
}
|
||||
|
||||
// Plain PHP implementation has slightly different behavior
|
||||
$config->set('Test', 'ForceNoIconv', true);
|
||||
$this->assertIdentical(
|
||||
HTMLPurifier_Encoder::convertFromUTF8("\xC3\xB6", $config, $context),
|
||||
"\xF6"
|
||||
);
|
||||
|
||||
$this->assertIdentical(
|
||||
HTMLPurifier_Encoder::convertFromUTF8($chinese, $config, $context),
|
||||
"?? (Chinese)"
|
||||
);
|
||||
|
||||
// Preserve the characters!
|
||||
|
||||
$config->set('Core', 'EscapeNonASCIICharacters', true);
|
||||
$this->assertIdentical(
|
||||
HTMLPurifier_Encoder::convertFromUTF8($chinese, $config, $context),
|
||||
"中文 (Chinese)"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function test_convertToASCIIDumbLossless() {
|
||||
|
||||
// Uppercase thorn letter
|
||||
$this->assertIdentical(
|
||||
HTMLPurifier_Encoder::convertToASCIIDumbLossless("\xC3\x9Eorn"),
|
||||
"Þorn"
|
||||
);
|
||||
|
||||
$this->assertIdentical(
|
||||
HTMLPurifier_Encoder::convertToASCIIDumbLossless("an"),
|
||||
"an"
|
||||
);
|
||||
|
||||
// test up to four bytes
|
||||
$this->assertIdentical(
|
||||
HTMLPurifier_Encoder::convertToASCIIDumbLossless("\xF3\xA0\x80\xA0"),
|
||||
"󠀠"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
35
tests/HTMLPurifier/SimpleTest/Reporter.php
Normal file
35
tests/HTMLPurifier/SimpleTest/Reporter.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
class HTMLPurifier_SimpleTest_Reporter extends HTMLReporter
|
||||
{
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -91,11 +91,10 @@ class HTMLPurifier_Strategy_FixNestingTest extends HTMLPurifier_StrategyHarness
|
||||
'<div>Reject</div>', 'Reject', array('HTML.Parent' => 'span')
|
||||
);
|
||||
|
||||
$this->expectError('Cannot use unrecognized element as parent.');
|
||||
$this->assertResult(
|
||||
'<div>Accept</div>', true, array('HTML.Parent' => 'script')
|
||||
);
|
||||
$this->assertError('Cannot use unrecognized element as parent.');
|
||||
$this->assertNoErrors();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ class HTMLPurifier_Strategy_ValidateAttributesTest extends
|
||||
'<bdo dir="ltr">Invalid value!</bdo>'
|
||||
);
|
||||
|
||||
// comparison check for test 20
|
||||
// see above, behavior is subtly different
|
||||
$this->assertResult(
|
||||
'<span dir="blahblah">Invalid value!</span>',
|
||||
'<span>Invalid value!</span>'
|
||||
@@ -176,4 +176,4 @@ class HTMLPurifier_Strategy_ValidateAttributesTest extends
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
11
tests/generate_mock_once.func.php
Normal file
11
tests/generate_mock_once.func.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
// since Mocks can't be called from within test files, we need to do
|
||||
// a little jumping through hoops to generate them
|
||||
function generate_mock_once($name) {
|
||||
$mock_name = $name . 'Mock';
|
||||
if (class_exists($mock_name)) return false;
|
||||
Mock::generate($name, $mock_name);
|
||||
}
|
||||
|
||||
?>
|
||||
139
tests/index.php
139
tests/index.php
@@ -1,147 +1,82 @@
|
||||
<?php
|
||||
|
||||
// call one file using /?f=FileTest.php , see $test_files array for
|
||||
// valid values
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
define('HTMLPurifierTest', 1);
|
||||
|
||||
// wishlist: automated calling of this file from multiple PHP versions so we
|
||||
// don't have to constantly switch around
|
||||
|
||||
// configuration
|
||||
// default settings (protect against register_globals)
|
||||
$GLOBALS['HTMLPurifierTest'] = array();
|
||||
$GLOBALS['HTMLPurifierTest']['PEAR'] = false; // do PEAR tests
|
||||
$simpletest_location = 'simpletest/'; // reasonable guess
|
||||
|
||||
$simpletest_location = 'simpletest/';
|
||||
if (file_exists('../test-settings.php')) include_once '../test-settings.php';
|
||||
// load SimpleTest
|
||||
@include '../test-settings.php'; // don't mind if it isn't there
|
||||
require_once $simpletest_location . 'unit_tester.php';
|
||||
require_once $simpletest_location . 'reporter.php';
|
||||
require_once $simpletest_location . 'mock_objects.php';
|
||||
require_once 'HTMLPurifier/SimpleTest/Reporter.php';
|
||||
|
||||
// configure PEAR if necessary
|
||||
// load Debugger
|
||||
require_once 'Debugger.php';
|
||||
|
||||
// load convenience functions
|
||||
require_once 'generate_mock_once.func.php';
|
||||
require_once 'path2class.func.php';
|
||||
require_once 'tally_errors.func.php'; // compat
|
||||
|
||||
// initialize PEAR (optional)
|
||||
if ( is_string($GLOBALS['HTMLPurifierTest']['PEAR']) ) {
|
||||
// if PEAR is true, we assume that there's no need to
|
||||
// add it to the path
|
||||
set_include_path($GLOBALS['HTMLPurifierTest']['PEAR'] . PATH_SEPARATOR .
|
||||
get_include_path());
|
||||
}
|
||||
|
||||
// debugger
|
||||
require_once 'Debugger.php';
|
||||
|
||||
// emulates inserting a dir called HTMLPurifier into your class dir
|
||||
// initialize and load HTML Purifier
|
||||
set_include_path('../library' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
// since Mocks can't be called from within test files, we need to do
|
||||
// a little jumping through hoops to generate them
|
||||
function generate_mock_once($name) {
|
||||
$mock_name = $name . 'Mock';
|
||||
if (class_exists($mock_name)) return false;
|
||||
Mock::generate($name, $mock_name);
|
||||
}
|
||||
|
||||
// this has to be defined before we do any includes of library files
|
||||
require_once 'HTMLPurifier.php';
|
||||
|
||||
// define callable test files
|
||||
// load tests
|
||||
$test_files = array();
|
||||
$test_files[] = 'ConfigTest.php';
|
||||
$test_files[] = 'ConfigSchemaTest.php';
|
||||
$test_files[] = 'LexerTest.php';
|
||||
$test_files[] = 'Lexer/DirectLexTest.php';
|
||||
$test_files[] = 'TokenTest.php';
|
||||
$test_files[] = 'ChildDef/RequiredTest.php';
|
||||
$test_files[] = 'ChildDef/OptionalTest.php';
|
||||
$test_files[] = 'ChildDef/ChameleonTest.php';
|
||||
$test_files[] = 'ChildDef/CustomTest.php';
|
||||
$test_files[] = 'ChildDef/TableTest.php';
|
||||
$test_files[] = 'ChildDef/StrictBlockquoteTest.php';
|
||||
$test_files[] = 'GeneratorTest.php';
|
||||
$test_files[] = 'EntityLookupTest.php';
|
||||
$test_files[] = 'Strategy/RemoveForeignElementsTest.php';
|
||||
$test_files[] = 'Strategy/MakeWellFormedTest.php';
|
||||
$test_files[] = 'Strategy/FixNestingTest.php';
|
||||
$test_files[] = 'Strategy/CompositeTest.php';
|
||||
$test_files[] = 'Strategy/CoreTest.php';
|
||||
$test_files[] = 'Strategy/ValidateAttributesTest.php';
|
||||
$test_files[] = 'AttrDefTest.php';
|
||||
$test_files[] = 'AttrDef/EnumTest.php';
|
||||
$test_files[] = 'AttrDef/IDTest.php';
|
||||
$test_files[] = 'AttrDef/ClassTest.php';
|
||||
$test_files[] = 'AttrDef/TextTest.php';
|
||||
$test_files[] = 'AttrDef/LangTest.php';
|
||||
$test_files[] = 'AttrDef/PixelsTest.php';
|
||||
$test_files[] = 'AttrDef/LengthTest.php';
|
||||
$test_files[] = 'AttrDef/URITest.php';
|
||||
$test_files[] = 'AttrDef/CSSTest.php';
|
||||
$test_files[] = 'AttrDef/CompositeTest.php';
|
||||
$test_files[] = 'AttrDef/ColorTest.php';
|
||||
$test_files[] = 'AttrDef/IntegerTest.php';
|
||||
$test_files[] = 'AttrDef/NumberTest.php';
|
||||
$test_files[] = 'AttrDef/CSSLengthTest.php';
|
||||
$test_files[] = 'AttrDef/PercentageTest.php';
|
||||
$test_files[] = 'AttrDef/MultipleTest.php';
|
||||
$test_files[] = 'AttrDef/TextDecorationTest.php';
|
||||
$test_files[] = 'AttrDef/FontFamilyTest.php';
|
||||
$test_files[] = 'AttrDef/HostTest.php';
|
||||
$test_files[] = 'AttrDef/IPv4Test.php';
|
||||
$test_files[] = 'AttrDef/IPv6Test.php';
|
||||
$test_files[] = 'AttrDef/FontTest.php';
|
||||
$test_files[] = 'AttrDef/BorderTest.php';
|
||||
$test_files[] = 'AttrDef/ListStyleTest.php';
|
||||
$test_files[] = 'AttrDef/Email/SimpleCheckTest.php';
|
||||
$test_files[] = 'AttrDef/CSSURITest.php';
|
||||
$test_files[] = 'IDAccumulatorTest.php';
|
||||
$test_files[] = 'TagTransformTest.php';
|
||||
$test_files[] = 'AttrTransform/LangTest.php';
|
||||
$test_files[] = 'AttrTransform/TextAlignTest.php';
|
||||
$test_files[] = 'AttrTransform/BdoDirTest.php';
|
||||
$test_files[] = 'AttrTransform/ImgRequiredTest.php';
|
||||
$test_files[] = 'URISchemeRegistryTest.php';
|
||||
$test_files[] = 'URISchemeTest.php';
|
||||
$test_files[] = 'EncoderTest.php';
|
||||
$test_files[] = 'EntityParserTest.php';
|
||||
$test_files[] = 'Test.php';
|
||||
$test_files[] = 'ContextTest.php';
|
||||
$test_files[] = 'PercentEncoderTest.php';
|
||||
|
||||
if (version_compare(PHP_VERSION, '5', '>=')) {
|
||||
$test_files[] = 'TokenFactoryTest.php';
|
||||
}
|
||||
|
||||
require 'test_files.php'; // populates $test_files array
|
||||
sort($test_files); // for the SELECT
|
||||
$GLOBALS['HTMLPurifierTest']['Files'] = $test_files; // for the reporter
|
||||
$test_file_lookup = array_flip($test_files);
|
||||
|
||||
function htmlpurifier_path2class($path) {
|
||||
$temp = $path;
|
||||
$temp = str_replace('./', '', $temp); // remove leading './'
|
||||
$temp = str_replace('.\\', '', $temp); // remove leading '.\'
|
||||
$temp = str_replace('\\', '_', $temp); // normalize \ to _
|
||||
$temp = str_replace('/', '_', $temp); // normalize / to _
|
||||
while(strpos($temp, '__') !== false) $temp = str_replace('__', '_', $temp);
|
||||
$temp = str_replace('.php', '', $temp);
|
||||
return $temp;
|
||||
// determine test file
|
||||
if (isset($_GET['f']) && isset($test_file_lookup[$_GET['f']])) {
|
||||
$GLOBALS['HTMLPurifierTest']['File'] = $_GET['f'];
|
||||
} else {
|
||||
$GLOBALS['HTMLPurifierTest']['File'] = false;
|
||||
}
|
||||
|
||||
// we can't use addTestFile because SimpleTest chokes on E_STRICT warnings
|
||||
|
||||
if (isset($_GET['file']) && isset($test_file_lookup[$_GET['file']])) {
|
||||
if ($test_file = $GLOBALS['HTMLPurifierTest']['File']) {
|
||||
|
||||
// execute only one test
|
||||
$test_file = $_GET['file'];
|
||||
|
||||
$test = new GroupTest('HTML Purifier - ' . $test_file);
|
||||
$test = new GroupTest($test_file . ' - HTML Purifier');
|
||||
$path = 'HTMLPurifier/' . $test_file;
|
||||
require_once $path;
|
||||
$test->addTestClass(htmlpurifier_path2class($path));
|
||||
$test->addTestClass(path2class($path));
|
||||
|
||||
} else {
|
||||
|
||||
$test = new GroupTest('HTML Purifier');
|
||||
$test = new GroupTest('All Tests - HTML Purifier');
|
||||
|
||||
foreach ($test_files as $test_file) {
|
||||
$path = 'HTMLPurifier/' . $test_file;
|
||||
require_once $path;
|
||||
$test->addTestClass(htmlpurifier_path2class($path));
|
||||
$test->addTestClass(path2class($path));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (SimpleReporter::inCli()) $reporter = new TextReporter();
|
||||
else $reporter = new HTMLReporter('UTF-8');
|
||||
else $reporter = new HTMLPurifier_SimpleTest_Reporter('UTF-8');
|
||||
|
||||
$test->run($reporter);
|
||||
|
||||
|
||||
14
tests/path2class.func.php
Normal file
14
tests/path2class.func.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
function path2class($path) {
|
||||
$temp = $path;
|
||||
$temp = str_replace('./', '', $temp); // remove leading './'
|
||||
$temp = str_replace('.\\', '', $temp); // remove leading '.\'
|
||||
$temp = str_replace('\\', '_', $temp); // normalize \ to _
|
||||
$temp = str_replace('/', '_', $temp); // normalize / to _
|
||||
while(strpos($temp, '__') !== false) $temp = str_replace('__', '_', $temp);
|
||||
$temp = str_replace('.php', '', $temp);
|
||||
return $temp;
|
||||
}
|
||||
|
||||
?>
|
||||
18
tests/tally_errors.func.php
Normal file
18
tests/tally_errors.func.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
function tally_errors() {
|
||||
// BRITTLE: relies on private code to work
|
||||
$context = &SimpleTest::getContext();
|
||||
$queue = &$context->get('SimpleErrorQueue');
|
||||
if (!isset($queue->_expectation_queue)) return; // fut-compat
|
||||
foreach ($queue->_expectation_queue as $e) {
|
||||
if (count($e) != 2) return; // fut-compat
|
||||
if (!isset($e[0])) return; // fut-compat
|
||||
$e[0]->_dumper = new SimpleDumper();
|
||||
$this->fail('Error expectation not fulfilled: ' .
|
||||
$e[0]->testMessage(null));
|
||||
}
|
||||
$queue->_expectation_queue = array();
|
||||
}
|
||||
|
||||
?>
|
||||
72
tests/test_files.php
Normal file
72
tests/test_files.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
if (!defined('HTMLPurifierTest')) exit;
|
||||
|
||||
// define callable test files
|
||||
$test_files[] = 'ConfigTest.php';
|
||||
$test_files[] = 'ConfigSchemaTest.php';
|
||||
$test_files[] = 'LexerTest.php';
|
||||
$test_files[] = 'Lexer/DirectLexTest.php';
|
||||
$test_files[] = 'TokenTest.php';
|
||||
$test_files[] = 'ChildDef/RequiredTest.php';
|
||||
$test_files[] = 'ChildDef/OptionalTest.php';
|
||||
$test_files[] = 'ChildDef/ChameleonTest.php';
|
||||
$test_files[] = 'ChildDef/CustomTest.php';
|
||||
$test_files[] = 'ChildDef/TableTest.php';
|
||||
$test_files[] = 'ChildDef/StrictBlockquoteTest.php';
|
||||
$test_files[] = 'GeneratorTest.php';
|
||||
$test_files[] = 'EntityLookupTest.php';
|
||||
$test_files[] = 'Strategy/RemoveForeignElementsTest.php';
|
||||
$test_files[] = 'Strategy/MakeWellFormedTest.php';
|
||||
$test_files[] = 'Strategy/FixNestingTest.php';
|
||||
$test_files[] = 'Strategy/CompositeTest.php';
|
||||
$test_files[] = 'Strategy/CoreTest.php';
|
||||
$test_files[] = 'Strategy/ValidateAttributesTest.php';
|
||||
$test_files[] = 'AttrDefTest.php';
|
||||
$test_files[] = 'AttrDef/EnumTest.php';
|
||||
$test_files[] = 'AttrDef/IDTest.php';
|
||||
$test_files[] = 'AttrDef/ClassTest.php';
|
||||
$test_files[] = 'AttrDef/TextTest.php';
|
||||
$test_files[] = 'AttrDef/LangTest.php';
|
||||
$test_files[] = 'AttrDef/PixelsTest.php';
|
||||
$test_files[] = 'AttrDef/LengthTest.php';
|
||||
$test_files[] = 'AttrDef/URITest.php';
|
||||
$test_files[] = 'AttrDef/CSSTest.php';
|
||||
$test_files[] = 'AttrDef/CompositeTest.php';
|
||||
$test_files[] = 'AttrDef/ColorTest.php';
|
||||
$test_files[] = 'AttrDef/IntegerTest.php';
|
||||
$test_files[] = 'AttrDef/NumberTest.php';
|
||||
$test_files[] = 'AttrDef/CSSLengthTest.php';
|
||||
$test_files[] = 'AttrDef/PercentageTest.php';
|
||||
$test_files[] = 'AttrDef/MultipleTest.php';
|
||||
$test_files[] = 'AttrDef/TextDecorationTest.php';
|
||||
$test_files[] = 'AttrDef/FontFamilyTest.php';
|
||||
$test_files[] = 'AttrDef/HostTest.php';
|
||||
$test_files[] = 'AttrDef/IPv4Test.php';
|
||||
$test_files[] = 'AttrDef/IPv6Test.php';
|
||||
$test_files[] = 'AttrDef/FontTest.php';
|
||||
$test_files[] = 'AttrDef/BorderTest.php';
|
||||
$test_files[] = 'AttrDef/ListStyleTest.php';
|
||||
$test_files[] = 'AttrDef/Email/SimpleCheckTest.php';
|
||||
$test_files[] = 'AttrDef/CSSURITest.php';
|
||||
$test_files[] = 'AttrDef/BackgroundPositionTest.php';
|
||||
$test_files[] = 'AttrDef/BackgroundTest.php';
|
||||
$test_files[] = 'IDAccumulatorTest.php';
|
||||
$test_files[] = 'TagTransformTest.php';
|
||||
$test_files[] = 'AttrTransform/LangTest.php';
|
||||
$test_files[] = 'AttrTransform/TextAlignTest.php';
|
||||
$test_files[] = 'AttrTransform/BdoDirTest.php';
|
||||
$test_files[] = 'AttrTransform/ImgRequiredTest.php';
|
||||
$test_files[] = 'URISchemeRegistryTest.php';
|
||||
$test_files[] = 'URISchemeTest.php';
|
||||
$test_files[] = 'EncoderTest.php';
|
||||
$test_files[] = 'EntityParserTest.php';
|
||||
$test_files[] = 'Test.php';
|
||||
$test_files[] = 'ContextTest.php';
|
||||
$test_files[] = 'PercentEncoderTest.php';
|
||||
|
||||
if (version_compare(PHP_VERSION, '5', '>=')) {
|
||||
$test_files[] = 'TokenFactoryTest.php';
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user