diff options
Diffstat (limited to 'lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed')
6 files changed, 0 insertions, 157 deletions
diff --git a/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/EndInsertInjector.php b/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/EndInsertInjector.php deleted file mode 100644 index d1724bcb3..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/EndInsertInjector.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -class HTMLPurifier_Strategy_MakeWellFormed_EndInsertInjector extends HTMLPurifier_Injector -{ - public $name = 'EndInsertInjector'; - public $needed = array('span'); - public function handleEnd(&$token) { - if ($token->name == 'div') return; - $token = array( - new HTMLPurifier_Token_Start('b'), - new HTMLPurifier_Token_Text('Comment'), - new HTMLPurifier_Token_End('b'), - $token - ); - } -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/EndInsertInjectorTest.php b/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/EndInsertInjectorTest.php deleted file mode 100644 index 72e833b71..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/EndInsertInjectorTest.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -class HTMLPurifier_Strategy_MakeWellFormed_EndInsertInjectorTest extends HTMLPurifier_StrategyHarness -{ - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_Strategy_MakeWellFormed(); - $this->config->set('AutoFormat.Custom', array( - new HTMLPurifier_Strategy_MakeWellFormed_EndInsertInjector() - )); - } - function testEmpty() { - $this->assertResult(''); - } - function testNormal() { - $this->assertResult('<i>Foo</i>', '<i>Foo<b>Comment</b></i>'); - } - function testEndOfDocumentProcessing() { - $this->assertResult('<i>Foo', '<i>Foo<b>Comment</b></i>'); - } - function testDoubleEndOfDocumentProcessing() { - $this->assertResult('<i><i>Foo', '<i><i>Foo<b>Comment</b></i><b>Comment</b></i>'); - } - function testEndOfNodeProcessing() { - $this->assertResult('<div><i>Foo</div>asdf', '<div><i>Foo<b>Comment</b></i></div><i>asdf<b>Comment</b></i>'); - } - function testEmptyToStartEndProcessing() { - $this->assertResult('<i />', '<i><b>Comment</b></i>'); - } - function testSpuriousEndTag() { - $this->assertResult('</i>', ''); - } - function testLessButStillSpuriousEndTag() { - $this->assertResult('<div></i></div>', '<div></div>'); - } -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/EndRewindInjector.php b/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/EndRewindInjector.php deleted file mode 100644 index 21c491436..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/EndRewindInjector.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -class HTMLPurifier_Strategy_MakeWellFormed_EndRewindInjector extends HTMLPurifier_Injector -{ - public $name = 'EndRewindInjector'; - public $needed = array('span'); - public function handleElement(&$token) { - if (isset($token->_InjectorTest_EndRewindInjector_delete)) { - $token = false; - } - } - public function handleText(&$token) { - $token = false; - } - public function handleEnd(&$token) { - $i = null; - if ( - $this->backward($i, $prev) && - $prev instanceof HTMLPurifier_Token_Start && - $prev->name == 'span' - ) { - $token = false; - $prev->_InjectorTest_EndRewindInjector_delete = true; - $this->rewind($i); - } - } -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/EndRewindInjectorTest.php b/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/EndRewindInjectorTest.php deleted file mode 100644 index 96c88748d..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/EndRewindInjectorTest.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -class HTMLPurifier_Strategy_MakeWellFormed_EndRewindInjectorTest extends HTMLPurifier_StrategyHarness -{ - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_Strategy_MakeWellFormed(); - $this->config->set('AutoFormat.Custom', array( - new HTMLPurifier_Strategy_MakeWellFormed_EndRewindInjector() - )); - } - function testBasic() { - $this->assertResult(''); - } - function testFunction() { - $this->assertResult('<span>asdf</span>',''); - } - function testFailedFunction() { - $this->assertResult('<span>asd<b>asdf</b>asdf</span>','<span><b></b></span>'); - } - function testPadded() { - $this->assertResult('<b></b><span>asdf</span><b></b>','<b></b><b></b>'); - } - function testDoubled() { - $this->config->set('AutoFormat.Custom', array( - new HTMLPurifier_Strategy_MakeWellFormed_EndRewindInjector(), - new HTMLPurifier_Strategy_MakeWellFormed_EndRewindInjector(), - )); - $this->assertResult('<b></b><span>asdf</span>', '<b></b>'); - } -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/SkipInjector.php b/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/SkipInjector.php deleted file mode 100644 index 258346b8d..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/SkipInjector.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -class HTMLPurifier_Strategy_MakeWellFormed_SkipInjector extends HTMLPurifier_Injector -{ - public $name = 'EndRewindInjector'; - public $needed = array('span'); - public function handleElement(&$token) { - $token = array(clone $token, clone $token); - } -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/SkipInjectorTest.php b/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/SkipInjectorTest.php deleted file mode 100644 index 770b3d84e..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/Strategy/MakeWellFormed/SkipInjectorTest.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -class HTMLPurifier_Strategy_MakeWellFormed_SkipInjectorTest extends HTMLPurifier_StrategyHarness -{ - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_Strategy_MakeWellFormed(); - $this->config->set('AutoFormat.Custom', array( - new HTMLPurifier_Strategy_MakeWellFormed_SkipInjector() - )); - } - function testEmpty() { - $this->assertResult(''); - } - function testMultiply() { - $this->assertResult('<br />', '<br /><br />'); - } - function testMultiplyMultiply() { - $this->config->set('AutoFormat.Custom', array( - new HTMLPurifier_Strategy_MakeWellFormed_SkipInjector(), - new HTMLPurifier_Strategy_MakeWellFormed_SkipInjector() - )); - $this->assertResult('<br />', '<br /><br /><br /><br />'); - } -} - -// vim: et sw=4 sts=4 |