aboutsummaryrefslogtreecommitdiffstats
path: root/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML
diff options
context:
space:
mode:
Diffstat (limited to 'lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML')
-rw-r--r--lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/BoolTest.php22
-rw-r--r--lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/ClassTest.php48
-rw-r--r--lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/ColorTest.php20
-rw-r--r--lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/FrameTargetTest.php28
-rw-r--r--lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/IDTest.php108
-rw-r--r--lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/LengthTest.php32
-rw-r--r--lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/LinkTypesTest.php21
-rw-r--r--lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/MultiLengthTest.php28
-rw-r--r--lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/NmtokensTest.php35
-rw-r--r--lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/PixelsTest.php45
10 files changed, 0 insertions, 387 deletions
diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/BoolTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/BoolTest.php
deleted file mode 100644
index 060d0fc8f..000000000
--- a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/BoolTest.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-class HTMLPurifier_AttrDef_HTML_BoolTest extends HTMLPurifier_AttrDefHarness
-{
-
- function test() {
- $this->def = new HTMLPurifier_AttrDef_HTML_Bool('foo');
- $this->assertDef('foo');
- $this->assertDef('', false);
- $this->assertDef('bar', 'foo');
- }
-
- function test_make() {
- $factory = new HTMLPurifier_AttrDef_HTML_Bool();
- $def = $factory->make('foo');
- $def2 = new HTMLPurifier_AttrDef_HTML_Bool('foo');
- $this->assertIdentical($def, $def2);
- }
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/ClassTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/ClassTest.php
deleted file mode 100644
index 6effd3cde..000000000
--- a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/ClassTest.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-class HTMLPurifier_AttrDef_HTML_ClassTest extends HTMLPurifier_AttrDef_HTML_NmtokensTest
-{
- function setUp() {
- parent::setUp();
- $this->def = new HTMLPurifier_AttrDef_HTML_Class();
- }
- function testAllowedClasses() {
- $this->config->set('Attr.AllowedClasses', array('foo'));
- $this->assertDef('foo');
- $this->assertDef('bar', false);
- $this->assertDef('foo bar', 'foo');
- }
- function testForbiddenClasses() {
- $this->config->set('Attr.ForbiddenClasses', array('bar'));
- $this->assertDef('foo');
- $this->assertDef('bar', false);
- $this->assertDef('foo bar', 'foo');
- }
- function testDefault() {
- $this->assertDef('valid');
- $this->assertDef('a0-_');
- $this->assertDef('-valid');
- $this->assertDef('_valid');
- $this->assertDef('double valid');
-
- $this->assertDef('0stillvalid');
- $this->assertDef('-0');
-
- // test conditional replacement
- $this->assertDef('validassoc 0valid', 'validassoc 0valid');
-
- // test whitespace leniency
- $this->assertDef(" double\nvalid\r", 'double valid');
-
- // test case sensitivity
- $this->assertDef('VALID');
-
- // test duplicate removal
- $this->assertDef('valid valid', 'valid');
- }
- function testXHTML11Behavior() {
- $this->config->set('HTML.Doctype', 'XHTML 1.1');
- $this->assertDef('0invalid', false);
- $this->assertDef('valid valid', 'valid');
- }
-}
diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/ColorTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/ColorTest.php
deleted file mode 100644
index 8b4a46347..000000000
--- a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/ColorTest.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-class HTMLPurifier_AttrDef_HTML_ColorTest extends HTMLPurifier_AttrDefHarness
-{
-
- function test() {
- $this->def = new HTMLPurifier_AttrDef_HTML_Color();
- $this->assertDef('', false);
- $this->assertDef('foo', false);
- $this->assertDef('43', false);
- $this->assertDef('red', '#FF0000');
- $this->assertDef('#FF0000');
- $this->assertDef('#453443');
- $this->assertDef('453443', '#453443');
- $this->assertDef('#345', '#334455');
- $this->assertDef('120', '#112200');
- }
-}
-
-// vim: et sw=4 sts=4
diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/FrameTargetTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/FrameTargetTest.php
deleted file mode 100644
index 7d3e24c75..000000000
--- a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/FrameTargetTest.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-class HTMLPurifier_AttrDef_HTML_FrameTargetTest extends HTMLPurifier_AttrDefHarness
-{
-
- function setup() {
- parent::setup();
- $this->def = new HTMLPurifier_AttrDef_HTML_FrameTarget();
- }
-
- function testNoneAllowed() {
- $this->assertDef('', false);
- $this->assertDef('foo', false);
- $this->assertDef('_blank', false);
- $this->assertDef('baz', false);
- }
-
- function test() {
- $this->config->set('Attr.AllowedFrameTargets', 'foo,_blank');
- $this->assertDef('', false);
- $this->assertDef('foo');
- $this->assertDef('_blank');
- $this->assertDef('baz', false);
- }
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/IDTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/IDTest.php
deleted file mode 100644
index 245db16da..000000000
--- a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/IDTest.php
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-
-class HTMLPurifier_AttrDef_HTML_IDTest extends HTMLPurifier_AttrDefHarness
-{
-
- function setUp() {
- parent::setUp();
-
- $id_accumulator = new HTMLPurifier_IDAccumulator();
- $this->context->register('IDAccumulator', $id_accumulator);
- $this->config->set('Attr.EnableID', true);
- $this->def = new HTMLPurifier_AttrDef_HTML_ID();
-
- }
-
- function test() {
-
- // valid ID names
- $this->assertDef('alpha');
- $this->assertDef('al_ha');
- $this->assertDef('a0-:.');
- $this->assertDef('a');
-
- // invalid ID names
- $this->assertDef('<asa', false);
- $this->assertDef('0123', false);
- $this->assertDef('.asa', false);
-
- // test duplicate detection
- $this->assertDef('once');
- $this->assertDef('once', false);
-
- // valid once whitespace stripped, but needs to be amended
- $this->assertDef(' whee ', 'whee');
-
- }
-
- function testPrefix() {
-
- $this->config->set('Attr.IDPrefix', 'user_');
-
- $this->assertDef('alpha', 'user_alpha');
- $this->assertDef('<asa', false);
- $this->assertDef('once', 'user_once');
- $this->assertDef('once', false);
-
- // if already prefixed, leave alone
- $this->assertDef('user_alas');
- $this->assertDef('user_user_alas'); // how to bypass
-
- }
-
- function testTwoPrefixes() {
-
- $this->config->set('Attr.IDPrefix', 'user_');
- $this->config->set('Attr.IDPrefixLocal', 'story95_');
-
- $this->assertDef('alpha', 'user_story95_alpha');
- $this->assertDef('<asa', false);
- $this->assertDef('once', 'user_story95_once');
- $this->assertDef('once', false);
-
- $this->assertDef('user_story95_alas');
- $this->assertDef('user_alas', 'user_story95_user_alas'); // !
- }
-
- function testLocalPrefixWithoutMainPrefix() {
- // no effect when IDPrefix isn't set
- $this->config->set('Attr.IDPrefix', '');
- $this->config->set('Attr.IDPrefixLocal', 'story95_');
- $this->expectError('%Attr.IDPrefixLocal cannot be used unless '.
- '%Attr.IDPrefix is set');
- $this->assertDef('amherst');
-
- }
-
- // reference functionality is disabled for now
- function disabled_testIDReference() {
-
- $this->def = new HTMLPurifier_AttrDef_HTML_ID(true);
-
- $this->assertDef('good_id');
- $this->assertDef('good_id'); // duplicates okay
- $this->assertDef('<b>', false);
-
- $this->def = new HTMLPurifier_AttrDef_HTML_ID();
-
- $this->assertDef('good_id');
- $this->assertDef('good_id', false); // duplicate now not okay
-
- $this->def = new HTMLPurifier_AttrDef_HTML_ID(true);
-
- $this->assertDef('good_id'); // reference still okay
-
- }
-
- function testRegexp() {
-
- $this->config->set('Attr.IDBlacklistRegexp', '/^g_/');
-
- $this->assertDef('good_id');
- $this->assertDef('g_bad_id', false);
-
- }
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/LengthTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/LengthTest.php
deleted file mode 100644
index d165e30b5..000000000
--- a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/LengthTest.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-class HTMLPurifier_AttrDef_HTML_LengthTest extends HTMLPurifier_AttrDef_HTML_PixelsTest
-{
-
- function setup() {
- $this->def = new HTMLPurifier_AttrDef_HTML_Length();
- }
-
- function test() {
-
- // pixel check
- parent::test();
-
- // percent check
- $this->assertDef('25%');
-
- // Firefox maintains percent, so will we
- $this->assertDef('0%');
-
- // 0% <= percent <= 100%
- $this->assertDef('-15%', '0%');
- $this->assertDef('120%', '100%');
-
- // fractional percents, apparently, aren't allowed
- $this->assertDef('56.5%', '56%');
-
- }
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/LinkTypesTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/LinkTypesTest.php
deleted file mode 100644
index d90b65b1f..000000000
--- a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/LinkTypesTest.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-class HTMLPurifier_AttrDef_HTML_LinkTypesTest extends HTMLPurifier_AttrDefHarness
-{
-
- function testNull() {
-
- $this->def = new HTMLPurifier_AttrDef_HTML_LinkTypes('rel');
- $this->config->set('Attr.AllowedRel', array('nofollow', 'foo'));
-
- $this->assertDef('', false);
- $this->assertDef('nofollow', true);
- $this->assertDef('nofollow foo', true);
- $this->assertDef('nofollow bar', 'nofollow');
- $this->assertDef('bar', false);
-
- }
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/MultiLengthTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/MultiLengthTest.php
deleted file mode 100644
index eb6f34011..000000000
--- a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/MultiLengthTest.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-class HTMLPurifier_AttrDef_HTML_MultiLengthTest extends HTMLPurifier_AttrDef_HTML_LengthTest
-{
-
- function setup() {
- $this->def = new HTMLPurifier_AttrDef_HTML_MultiLength();
- }
-
- function test() {
-
- // length check
- parent::test();
-
- $this->assertDef('*');
- $this->assertDef('1*', '*');
- $this->assertDef('56*');
-
- $this->assertDef('**', false); // plain old bad
-
- $this->assertDef('5.4*', '5*'); // no decimals
- $this->assertDef('-3*', false); // no negatives
-
- }
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/NmtokensTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/NmtokensTest.php
deleted file mode 100644
index bb64ff6e2..000000000
--- a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/NmtokensTest.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-class HTMLPurifier_AttrDef_HTML_NmtokensTest extends HTMLPurifier_AttrDefHarness
-{
-
- function setUp() {
- parent::setUp();
- $this->def = new HTMLPurifier_AttrDef_HTML_Nmtokens();
- }
-
- function testDefault() {
-
- $this->assertDef('valid');
- $this->assertDef('a0-_');
- $this->assertDef('-valid');
- $this->assertDef('_valid');
- $this->assertDef('double valid');
-
- $this->assertDef('0invalid', false);
- $this->assertDef('-0', false);
-
- // test conditional replacement
- $this->assertDef('validassoc 0invalid', 'validassoc');
-
- // test whitespace leniency
- $this->assertDef(" double\nvalid\r", 'double valid');
-
- // test case sensitivity
- $this->assertDef('VALID');
-
- }
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/PixelsTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/PixelsTest.php
deleted file mode 100644
index 08f25be64..000000000
--- a/lib/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/PixelsTest.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-class HTMLPurifier_AttrDef_HTML_PixelsTest extends HTMLPurifier_AttrDefHarness
-{
-
- function setup() {
- $this->def = new HTMLPurifier_AttrDef_HTML_Pixels();
- }
-
- function test() {
-
- $this->assertDef('1');
- $this->assertDef('0');
-
- $this->assertDef('2px', '2'); // rm px suffix
-
- $this->assertDef('dfs', false); // totally invalid value
-
- // conceivably we could repair this value, but we won't for now
- $this->assertDef('9in', false);
-
- // test trim
- $this->assertDef(' 45 ', '45');
-
- // no negatives
- $this->assertDef('-2', '0');
-
- // remove empty
- $this->assertDef('', false);
-
- // round down
- $this->assertDef('4.9', '4');
-
- }
-
- function test_make() {
- $factory = new HTMLPurifier_AttrDef_HTML_Pixels();
- $this->def = $factory->make('30');
- $this->assertDef('25');
- $this->assertDef('35', '30');
- }
-
-}
-
-// vim: et sw=4 sts=4