From 22cf19e174bcee88b44968f2773d1bad2da2b54d Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 18 Jul 2012 03:59:10 -0700 Subject: bad sync with github windows client --- .../tests/HTMLPurifier/HTMLModule/FormsTest.php | 155 -------------- .../tests/HTMLPurifier/HTMLModule/ImageTest.php | 55 ----- .../tests/HTMLPurifier/HTMLModule/NameTest.php | 32 --- .../tests/HTMLPurifier/HTMLModule/NofollowTest.php | 26 --- .../tests/HTMLPurifier/HTMLModule/ObjectTest.php | 38 ---- .../HTMLPurifier/HTMLModule/ProprietaryTest.php | 30 --- .../tests/HTMLPurifier/HTMLModule/RubyTest.php | 55 ----- .../HTMLPurifier/HTMLModule/SafeEmbedTest.php | 41 ---- .../HTMLPurifier/HTMLModule/SafeObjectTest.php | 49 ----- .../HTMLPurifier/HTMLModule/ScriptingTest.php | 55 ----- .../HTMLPurifier/HTMLModule/TargetBlankTest.php | 20 -- .../tests/HTMLPurifier/HTMLModule/TidyTest.php | 224 --------------------- 12 files changed, 780 deletions(-) delete mode 100644 lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/FormsTest.php delete mode 100644 lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ImageTest.php delete mode 100644 lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/NameTest.php delete mode 100644 lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/NofollowTest.php delete mode 100644 lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ObjectTest.php delete mode 100644 lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ProprietaryTest.php delete mode 100644 lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/RubyTest.php delete mode 100644 lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/SafeEmbedTest.php delete mode 100644 lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/SafeObjectTest.php delete mode 100644 lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ScriptingTest.php delete mode 100644 lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/TargetBlankTest.php delete mode 100644 lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/TidyTest.php (limited to 'lib/htmlpurifier/tests/HTMLPurifier/HTMLModule') diff --git a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/FormsTest.php b/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/FormsTest.php deleted file mode 100644 index 5bc4c99c3..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/FormsTest.php +++ /dev/null @@ -1,155 +0,0 @@ -config->set('HTML.Trusted', true); - $this->config->set('Attr.EnableID', true); - } - - function testBasicUse() { - $this->config->set('HTML.Doctype', 'HTML 4.01 Strict'); - $this->assertResult( // need support for label for later - ' -
-

- -
- -
- -
- Male
- Female
- -

-
' - ); - } - - function testSelectOption() { - $this->config->set('HTML.Doctype', 'HTML 4.01 Strict'); - $this->assertResult(' -
-

- - -

-
- '); - } - - function testSelectOptgroup() { - $this->config->set('HTML.Doctype', 'HTML 4.01 Strict'); - $this->assertResult(' -
-

- -

-
- '); - } - - function testTextarea() { - $this->config->set('HTML.Doctype', 'HTML 4.01 Strict'); - $this->assertResult(' -
-

- - -

-
- '); - } - - // label tests omitted - - function testFieldset() { - $this->config->set('HTML.Doctype', 'HTML 4.01 Strict'); - $this->assertResult(' -
-
- Personal Information - Last Name: - First Name: - Address: - ...more personal information... -
-
- Medical History - Smallpox - Mumps - Dizziness - Sneezing - ...more medical history... -
-
- Current Medication - Are you currently taking any medication? - Yes - No - - If you are currently taking medication, please indicate - it in the space below: - -
-
- '); - } - - function testInputTransform() { - $this->config->set('HTML.Doctype', 'XHTML 1.0 Strict'); - $this->assertResult('', ''); - } - - function testTextareaTransform() { - $this->config->set('HTML.Doctype', 'HTML 4.01 Strict'); - $this->assertResult('', ''); - } - - function testTextInFieldset() { - $this->config->set('HTML.Doctype', 'HTML 4.01 Strict'); - $this->assertResult('
foo
'); - } - - function testStrict() { - $this->config->set('HTML.Doctype', 'HTML 4.01 Strict'); - $this->assertResult('
', ''); - } - - function testLegacy() { - $this->assertResult('
'); - $this->assertResult('
'); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ImageTest.php b/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ImageTest.php deleted file mode 100644 index 30e36f1d1..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ImageTest.php +++ /dev/null @@ -1,55 +0,0 @@ -assertResult(''); - } - - function testLengthTooLarge() { - $this->assertResult( - '', - '' - ); - } - - function testLengthPercentage() { - $this->assertResult( - '', - '' - ); - } - - function testLengthCustomMax() { - $this->config->set('HTML.MaxImgLength', 20); - $this->assertResult( - '', - '' - ); - } - - function testLengthCrashFixDisabled() { - $this->config->set('HTML.MaxImgLength', null); - $this->assertResult( - '' - ); - $this->assertResult( - '' - ); - } - - function testLengthTrusted() { - $this->config->set('HTML.Trusted', true); - $this->assertResult( - '' - ); - $this->assertResult( - '' - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/NameTest.php b/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/NameTest.php deleted file mode 100644 index 9152710bd..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/NameTest.php +++ /dev/null @@ -1,32 +0,0 @@ -config->set('Attr.EnableID', true); - $this->assertResult( - 'bar' - ); - } - - function testCDATA() { - $this->config->set('HTML.Attr.Name.UseCDATA', true); - $this->assertResult( - 'BazBar' - ); - } - - function testCDATAWithHeavyTidy() { - $this->config->set('HTML.Attr.Name.UseCDATA', true); - $this->config->set('HTML.TidyLevel', 'heavy'); - $this->assertResult('Baz'); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/NofollowTest.php b/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/NofollowTest.php deleted file mode 100644 index 43084de3a..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/NofollowTest.php +++ /dev/null @@ -1,26 +0,0 @@ -config->set('HTML.Nofollow', true); - } - - function testNofollow() { - $this->assertResult( - 'abc', - 'abc' - ); - } - - function testNofollowDupe() { - $this->assertResult( - 'abc' - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ObjectTest.php b/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ObjectTest.php deleted file mode 100644 index f824d6021..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ObjectTest.php +++ /dev/null @@ -1,38 +0,0 @@ -config->set('HTML.Trusted', true); - } - - function testDefaultRemoval() { - $this->config->set('HTML.Trusted', false); - $this->assertResult( - '', '' - ); - } - - function testMinimal() { - $this->assertResult(''); - } - - function testStandardUseCase() { - $this->assertResult( -' - - - - -Windows Media player required -' - ); - } - - // more test-cases? - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ProprietaryTest.php b/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ProprietaryTest.php deleted file mode 100644 index 21ebe8a5b..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ProprietaryTest.php +++ /dev/null @@ -1,30 +0,0 @@ -config->set('HTML.Proprietary', true); - } - - function testMarquee() { - $this->assertResult( - '
Block
InlineText
' - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/RubyTest.php b/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/RubyTest.php deleted file mode 100644 index 23a1400d0..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/RubyTest.php +++ /dev/null @@ -1,55 +0,0 @@ -config->set('HTML.Doctype', 'XHTML 1.1'); - } - - function testBasicUse() { - $this->assertResult( - 'WWWWorld Wide Web' - ); - } - - function testRPUse() { - $this->assertResult( - 'WWW(World Wide Web)' - ); - } - - function testComplexUse() { - $this->assertResult( -' - - 10 - 31 - 2002 - - - Month - Day - Year - - - Expiration Date - -' - ); - - /* not implemented - function testBackwardsCompat() { - $this->assertResult( - 'A(aaa)', - 'A(aaa)' - ); - } - */ - - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/SafeEmbedTest.php b/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/SafeEmbedTest.php deleted file mode 100644 index 779d34857..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/SafeEmbedTest.php +++ /dev/null @@ -1,41 +0,0 @@ -config->getHTMLDefinition(true); - $def->manager->addModule('SafeEmbed'); - } - - function testMinimal() { - $this->assertResult( - '', - '' - ); - } - - function testYouTube() { - $this->assertResult( - '', - '' - ); - } - - function testMalicious() { - $this->assertResult( - '', - '' - ); - } - - function testFull() { - $this->assertResult( - '' - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/SafeObjectTest.php b/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/SafeObjectTest.php deleted file mode 100644 index d8a23d50f..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/SafeObjectTest.php +++ /dev/null @@ -1,49 +0,0 @@ -config->set('HTML.DefinitionID', 'HTMLPurifier_HTMLModule_SafeObjectTest'); - $this->config->set('HTML.SafeObject', true); - } - - function testMinimal() { - $this->assertResult( - '', - '' - ); - } - - function testYouTube() { - // embed is purposely removed - $this->assertResult( - '', - '' - ); - } - - function testMalicious() { - $this->assertResult( - '', - '' - ); - } - - function testFull() { - $this->assertResult( - '' - ); - } - - function testFullScreen() { - $this->config->set('HTML.FlashAllowFullScreen', true); - $this->assertResult( - '' - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ScriptingTest.php b/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ScriptingTest.php deleted file mode 100644 index c844a4776..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/ScriptingTest.php +++ /dev/null @@ -1,55 +0,0 @@ -config->set('HTML.Trusted', true); - $this->config->set('Output.CommentScriptContents', false); - } - - function testDefaultRemoval() { - $this->config->set('HTML.Trusted', false); - $this->assertResult( - '', '' - ); - } - - function testPreserve() { - $this->assertResult( - '' - ); - } - - function testCDATAEnclosure() { - $this->assertResult( -'' - ); - } - - function testAllAttributes() { - $this->assertResult( - '' - ); - } - - function testUnsupportedAttributes() { - $this->assertResult( - '', - '' - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/TargetBlankTest.php b/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/TargetBlankTest.php deleted file mode 100644 index a757fecb3..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/TargetBlankTest.php +++ /dev/null @@ -1,20 +0,0 @@ -config->set('HTML.TargetBlank', true); - } - - function testTargetBlank() { - $this->assertResult( - 'abc', - 'abc' - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/TidyTest.php b/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/TidyTest.php deleted file mode 100644 index e80aeb16d..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/HTMLModule/TidyTest.php +++ /dev/null @@ -1,224 +0,0 @@ -fixesForLevel['light'][] = 'light-fix'; - $module->fixesForLevel['medium'][] = 'medium-fix'; - $module->fixesForLevel['heavy'][] = 'heavy-fix'; - - $this->assertIdentical( - array(), - $module->getFixesForLevel('none') - ); - $this->assertIdentical( - array('light-fix' => true), - $module->getFixesForLevel('light') - ); - $this->assertIdentical( - array('light-fix' => true, 'medium-fix' => true), - $module->getFixesForLevel('medium') - ); - $this->assertIdentical( - array('light-fix' => true, 'medium-fix' => true, 'heavy-fix' => true), - $module->getFixesForLevel('heavy') - ); - - $this->expectError('Tidy level turbo not recognized'); - $module->getFixesForLevel('turbo'); - - } - - function test_setup() { - - $i = 0; // counter, helps us isolate expectations - - // initialize partial mock - $module = new HTMLPurifier_HTMLModule_Tidy_TestForConstruct(); - $module->fixesForLevel['light'] = array('light-fix-1', 'light-fix-2'); - $module->fixesForLevel['medium'] = array('medium-fix-1', 'medium-fix-2'); - $module->fixesForLevel['heavy'] = array('heavy-fix-1', 'heavy-fix-2'); - - $j = 0; - $fixes = array( - 'light-fix-1' => $lf1 = $j++, - 'light-fix-2' => $lf2 = $j++, - 'medium-fix-1' => $mf1 = $j++, - 'medium-fix-2' => $mf2 = $j++, - 'heavy-fix-1' => $hf1 = $j++, - 'heavy-fix-2' => $hf2 = $j++ - ); - $module->setReturnValue('makeFixes', $fixes); - - $config = HTMLPurifier_Config::create(array( - 'HTML.TidyLevel' => 'none' - )); - $module->expectAt($i++, 'populate', array(array())); - $module->setup($config); - - // basic levels - - $config = HTMLPurifier_Config::create(array( - 'HTML.TidyLevel' => 'light' - )); - $module->expectAt($i++, 'populate', array(array( - 'light-fix-1' => $lf1, - 'light-fix-2' => $lf2 - ))); - $module->setup($config); - - $config = HTMLPurifier_Config::create(array( - 'HTML.TidyLevel' => 'heavy' - )); - $module->expectAt($i++, 'populate', array(array( - 'light-fix-1' => $lf1, - 'light-fix-2' => $lf2, - 'medium-fix-1' => $mf1, - 'medium-fix-2' => $mf2, - 'heavy-fix-1' => $hf1, - 'heavy-fix-2' => $hf2 - ))); - $module->setup($config); - - // fine grained tuning - - $config = HTMLPurifier_Config::create(array( - 'HTML.TidyLevel' => 'none', - 'HTML.TidyAdd' => array('light-fix-1', 'medium-fix-1') - )); - $module->expectAt($i++, 'populate', array(array( - 'light-fix-1' => $lf1, - 'medium-fix-1' => $mf1 - ))); - $module->setup($config); - - $config = HTMLPurifier_Config::create(array( - 'HTML.TidyLevel' => 'medium', - 'HTML.TidyRemove' => array('light-fix-1', 'medium-fix-1') - )); - $module->expectAt($i++, 'populate', array(array( - 'light-fix-2' => $lf2, - 'medium-fix-2' => $mf2 - ))); - $module->setup($config); - - } - - function test_makeFixesForLevel() { - - $module = new HTMLPurifier_HTMLModule_Tidy(); - $module->defaultLevel = 'heavy'; - - $module->makeFixesForLevel(array( - 'fix-1' => 0, - 'fix-2' => 1, - 'fix-3' => 2 - )); - - $this->assertIdentical($module->fixesForLevel['heavy'], array('fix-1', 'fix-2', 'fix-3')); - $this->assertIdentical($module->fixesForLevel['medium'], array()); - $this->assertIdentical($module->fixesForLevel['light'], array()); - - } - function test_makeFixesForLevel_undefinedLevel() { - - $module = new HTMLPurifier_HTMLModule_Tidy(); - $module->defaultLevel = 'bananas'; - - $this->expectError('Default level bananas does not exist'); - - $module->makeFixesForLevel(array( - 'fix-1' => 0 - )); - - } - - function test_getFixType() { - - // syntax needs documenting - - $module = new HTMLPurifier_HTMLModule_Tidy(); - - $this->assertIdentical( - $module->getFixType('a'), - array('tag_transform', array('element' => 'a')) - ); - - $this->assertIdentical( - $module->getFixType('a@href'), - $reuse = array('attr_transform_pre', array('element' => 'a', 'attr' => 'href')) - ); - - $this->assertIdentical( - $module->getFixType('a@href#pre'), - $reuse - ); - - $this->assertIdentical( - $module->getFixType('a@href#post'), - array('attr_transform_post', array('element' => 'a', 'attr' => 'href')) - ); - - $this->assertIdentical( - $module->getFixType('xml:foo@xml:bar'), - array('attr_transform_pre', array('element' => 'xml:foo', 'attr' => 'xml:bar')) - ); - - $this->assertIdentical( - $module->getFixType('blockquote#child'), - array('child', array('element' => 'blockquote')) - ); - - $this->assertIdentical( - $module->getFixType('@lang'), - array('attr_transform_pre', array('attr' => 'lang')) - ); - - $this->assertIdentical( - $module->getFixType('@lang#post'), - array('attr_transform_post', array('attr' => 'lang')) - ); - - } - - function test_populate() { - - $i = 0; - - $module = new HTMLPurifier_HTMLModule_Tidy(); - $module->populate(array( - 'element' => $element = $i++, - 'element@attr' => $attr = $i++, - 'element@attr#post' => $attr_post = $i++, - 'element#child' => $child = $i++, - 'element#content_model_type' => $content_model_type = $i++, - '@attr' => $global_attr = $i++, - '@attr#post' => $global_attr_post = $i++ - )); - - $module2 = new HTMLPurifier_HTMLModule_Tidy(); - $e = $module2->addBlankElement('element'); - $e->attr_transform_pre['attr'] = $attr; - $e->attr_transform_post['attr'] = $attr_post; - $e->child = $child; - $e->content_model_type = $content_model_type; - $module2->info_tag_transform['element'] = $element; - $module2->info_attr_transform_pre['attr'] = $global_attr; - $module2->info_attr_transform_post['attr'] = $global_attr_post; - - $this->assertEqual($module, $module2); - - } - -} - -// vim: et sw=4 sts=4 -- cgit v1.2.3