diff options
author | friendica <info@friendica.com> | 2012-07-18 03:59:10 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-07-18 03:59:10 -0700 |
commit | 22cf19e174bcee88b44968f2773d1bad2da2b54d (patch) | |
tree | f4e01db6f73754418438b020c2327e18c256653c /lib/htmlpurifier/tests/HTMLPurifier/AttrTransform | |
parent | 7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a (diff) | |
download | volse-hubzilla-22cf19e174bcee88b44968f2773d1bad2da2b54d.tar.gz volse-hubzilla-22cf19e174bcee88b44968f2773d1bad2da2b54d.tar.bz2 volse-hubzilla-22cf19e174bcee88b44968f2773d1bad2da2b54d.zip |
bad sync with github windows client
Diffstat (limited to 'lib/htmlpurifier/tests/HTMLPurifier/AttrTransform')
13 files changed, 0 insertions, 629 deletions
diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BackgroundTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BackgroundTest.php deleted file mode 100644 index 0730ab4bc..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BackgroundTest.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -class HTMLPurifier_AttrTransform_BackgroundTest extends HTMLPurifier_AttrTransformHarness -{ - - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_AttrTransform_Background(); - } - - function testEmptyInput() { - $this->assertResult( array() ); - } - - function testBasicTransform() { - $this->assertResult( - array('background' => 'logo.png'), - array('style' => 'background-image:url(logo.png);') - ); - } - - function testPrependNewCSS() { - $this->assertResult( - array('background' => 'logo.png', 'style' => 'font-weight:bold'), - array('style' => 'background-image:url(logo.png);font-weight:bold') - ); - } - - function testLenientTreatmentOfInvalidInput() { - // notice that we rely on the CSS validator later to fix this invalid - // stuff - $this->assertResult( - array('background' => 'logo.png);foo:('), - array('style' => 'background-image:url(logo.png);foo:();') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BdoDirTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BdoDirTest.php deleted file mode 100644 index cdf6f8a9b..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BdoDirTest.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -class HTMLPurifier_AttrTransform_BdoDirTest extends HTMLPurifier_AttrTransformHarness -{ - - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_AttrTransform_BdoDir(); - } - - function testAddDefaultDir() { - $this->assertResult( array(), array('dir' => 'ltr') ); - } - - function testPreserveExistingDir() { - $this->assertResult( array('dir' => 'rtl') ); - } - - function testAlternateDefault() { - $this->config->set('Attr.DefaultTextDir', 'rtl'); - $this->assertResult( - array(), - array('dir' => 'rtl') - ); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BgColorTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BgColorTest.php deleted file mode 100644 index 13567b74e..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BgColorTest.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -// we currently rely on the CSS validator to fix any problems. -// This means that this transform, strictly speaking, supports -// a superset of the functionality. - -class HTMLPurifier_AttrTransform_BgColorTest extends HTMLPurifier_AttrTransformHarness -{ - - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_AttrTransform_BgColor(); - } - - function testEmptyInput() { - $this->assertResult( array() ); - } - - function testBasicTransform() { - $this->assertResult( - array('bgcolor' => '#000000'), - array('style' => 'background-color:#000000;') - ); - } - - function testPrependNewCSS() { - $this->assertResult( - array('bgcolor' => '#000000', 'style' => 'font-weight:bold'), - array('style' => 'background-color:#000000;font-weight:bold') - ); - } - - function testLenientTreatmentOfInvalidInput() { - // this may change when we natively support the datatype and - // validate its contents before forwarding it on - $this->assertResult( - array('bgcolor' => '#F00'), - array('style' => 'background-color:#F00;') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BoolToCSSTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BoolToCSSTest.php deleted file mode 100644 index 73f9d6b86..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BoolToCSSTest.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -class HTMLPurifier_AttrTransform_BoolToCSSTest extends HTMLPurifier_AttrTransformHarness -{ - - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_AttrTransform_BoolToCSS('foo', 'bar:3in;'); - } - - function testEmptyInput() { - $this->assertResult( array() ); - } - - function testBasicTransform() { - $this->assertResult( - array('foo' => 'foo'), - array('style' => 'bar:3in;') - ); - } - - function testIgnoreValueOfBooleanAttribute() { - $this->assertResult( - array('foo' => 'no'), - array('style' => 'bar:3in;') - ); - } - - function testPrependCSS() { - $this->assertResult( - array('foo' => 'foo', 'style' => 'background-color:#F00;'), - array('style' => 'bar:3in;background-color:#F00;') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BorderTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BorderTest.php deleted file mode 100644 index d10aa28e6..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/BorderTest.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -class HTMLPurifier_AttrTransform_BorderTest extends HTMLPurifier_AttrTransformHarness -{ - - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_AttrTransform_Border(); - } - - function testEmptyInput() { - $this->assertResult( array() ); - } - - function testBasicTransform() { - $this->assertResult( - array('border' => '1'), - array('style' => 'border:1px solid;') - ); - } - - function testLenientTreatmentOfInvalidInput() { - $this->assertResult( - array('border' => '10%'), - array('style' => 'border:10%px solid;') - ); - } - - function testPrependNewCSS() { - $this->assertResult( - array('border' => '23', 'style' => 'font-weight:bold;'), - array('style' => 'border:23px solid;font-weight:bold;') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/EnumToCSSTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/EnumToCSSTest.php deleted file mode 100644 index f0381fe88..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/EnumToCSSTest.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -class HTMLPurifier_AttrTransform_EnumToCSSTest extends HTMLPurifier_AttrTransformHarness -{ - - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_AttrTransform_EnumToCSS('align', array( - 'left' => 'text-align:left;', - 'right' => 'text-align:right;' - )); - } - - function testEmptyInput() { - $this->assertResult( array() ); - } - - function testPreserveArraysWithoutInterestingAttributes() { - $this->assertResult( array('style' => 'font-weight:bold;') ); - } - - function testConvertAlignLeft() { - $this->assertResult( - array('align' => 'left'), - array('style' => 'text-align:left;') - ); - } - - function testConvertAlignRight() { - $this->assertResult( - array('align' => 'right'), - array('style' => 'text-align:right;') - ); - } - - function testRemoveInvalidAlign() { - $this->assertResult( - array('align' => 'invalid'), - array() - ); - } - - function testPrependNewCSS() { - $this->assertResult( - array('align' => 'left', 'style' => 'font-weight:bold;'), - array('style' => 'text-align:left;font-weight:bold;') - ); - - } - - function testCaseInsensitive() { - $this->obj = new HTMLPurifier_AttrTransform_EnumToCSS('align', array( - 'right' => 'text-align:right;' - )); - $this->assertResult( - array('align' => 'RIGHT'), - array('style' => 'text-align:right;') - ); - } - - function testCaseSensitive() { - $this->obj = new HTMLPurifier_AttrTransform_EnumToCSS('align', array( - 'right' => 'text-align:right;' - ), true); - $this->assertResult( - array('align' => 'RIGHT'), - array() - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/ImgRequiredTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/ImgRequiredTest.php deleted file mode 100644 index 99f0a03e9..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/ImgRequiredTest.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -class HTMLPurifier_AttrTransform_ImgRequiredTest extends HTMLPurifier_AttrTransformHarness -{ - - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_AttrTransform_ImgRequired(); - } - - function testAddMissingAttr() { - $this->config->set('Core.RemoveInvalidImg', false); - $this->assertResult( - array(), - array('src' => '', 'alt' => 'Invalid image') - ); - } - - function testAlternateDefaults() { - $this->config->set('Attr.DefaultInvalidImage', 'blank.png'); - $this->config->set('Attr.DefaultInvalidImageAlt', 'Pawned!'); - $this->config->set('Attr.DefaultImageAlt', 'not pawned'); - $this->config->set('Core.RemoveInvalidImg', false); - $this->assertResult( - array(), - array('src' => 'blank.png', 'alt' => 'Pawned!') - ); - } - - function testGenerateAlt() { - $this->assertResult( - array('src' => '/path/to/foobar.png'), - array('src' => '/path/to/foobar.png', 'alt' => 'foobar.png') - ); - } - - function testAddDefaultSrc() { - $this->config->set('Core.RemoveInvalidImg', false); - $this->assertResult( - array('alt' => 'intrigue'), - array('alt' => 'intrigue', 'src' => '') - ); - } - - function testAddDefaultAlt() { - $this->config->set('Attr.DefaultImageAlt', 'default'); - $this->assertResult( - array('src' => ''), - array('src' => '', 'alt' => 'default') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/ImgSpaceTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/ImgSpaceTest.php deleted file mode 100644 index 42e8738e4..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/ImgSpaceTest.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -class HTMLPurifier_AttrTransform_ImgSpaceTest extends HTMLPurifier_AttrTransformHarness -{ - - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_AttrTransform_ImgSpace('vspace'); - } - - function testEmptyInput() { - $this->assertResult( array() ); - } - - function testVerticalBasicUsage() { - $this->assertResult( - array('vspace' => '1'), - array('style' => 'margin-top:1px;margin-bottom:1px;') - ); - } - - function testLenientHandlingOfInvalidInput() { - $this->assertResult( - array('vspace' => '10%'), - array('style' => 'margin-top:10%px;margin-bottom:10%px;') - ); - } - - function testPrependNewCSS() { - $this->assertResult( - array('vspace' => '23', 'style' => 'font-weight:bold;'), - array('style' => 'margin-top:23px;margin-bottom:23px;font-weight:bold;') - ); - } - - function testHorizontalBasicUsage() { - $this->obj = new HTMLPurifier_AttrTransform_ImgSpace('hspace'); - $this->assertResult( - array('hspace' => '1'), - array('style' => 'margin-left:1px;margin-right:1px;') - ); - } - - function testInvalidConstructionParameter() { - $this->expectError('ispace is not valid space attribute'); - $this->obj = new HTMLPurifier_AttrTransform_ImgSpace('ispace'); - $this->assertResult( - array('ispace' => '1'), - array() - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/InputTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/InputTest.php deleted file mode 100644 index 2603ff1be..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/InputTest.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php - -class HTMLPurifier_AttrTransform_InputTest extends HTMLPurifier_AttrTransformHarness -{ - - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_AttrTransform_Input(); - } - - function testEmptyInput() { - $this->assertResult(array()); - } - - function testInvalidCheckedWithEmpty() { - $this->assertResult(array('checked' => 'checked'), array()); - } - - function testInvalidCheckedWithPassword() { - $this->assertResult(array( - 'checked' => 'checked', - 'type' => 'password' - ), array( - 'type' => 'password' - )); - } - - function testValidCheckedWithUcCheckbox() { - $this->assertResult(array( - 'checked' => 'checked', - 'type' => 'CHECKBOX', - 'value' => 'bar', - )); - } - - function testInvalidMaxlength() { - $this->assertResult(array( - 'maxlength' => '10', - 'type' => 'checkbox', - 'value' => 'foo', - ), array( - 'type' => 'checkbox', - 'value' => 'foo', - )); - } - - function testValidMaxLength() { - $this->assertResult(array( - 'maxlength' => '10', - )); - } - - // these two are really bad test-cases - - function testSizeWithCheckbox() { - $this->assertResult(array( - 'type' => 'checkbox', - 'value' => 'foo', - 'size' => '100px', - ), array( - 'type' => 'checkbox', - 'value' => 'foo', - 'size' => '100', - )); - } - - function testSizeWithText() { - $this->assertResult(array( - 'type' => 'password', - 'size' => '100px', // spurious value, to indicate no validation takes place - ), array( - 'type' => 'password', - 'size' => '100px', - )); - } - - function testInvalidSrc() { - $this->assertResult(array( - 'src' => 'img.png', - ), array()); - } - - function testMissingValue() { - $this->assertResult(array( - 'type' => 'checkbox', - ), array( - 'type' => 'checkbox', - 'value' => '', - )); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/LangTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/LangTest.php deleted file mode 100644 index 960ad20a0..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/LangTest.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -class HTMLPurifier_AttrTransform_LangTest - extends HTMLPurifier_AttrTransformHarness -{ - - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_AttrTransform_Lang(); - } - - function testEmptyInput() { - $this->assertResult(array()); - } - - function testCopyLangToXMLLang() { - $this->assertResult( - array('lang' => 'en'), - array('lang' => 'en', 'xml:lang' => 'en') - ); - } - - function testPreserveAttributes() { - $this->assertResult( - array('src' => 'vert.png', 'lang' => 'fr'), - array('src' => 'vert.png', 'lang' => 'fr', 'xml:lang' => 'fr') - ); - } - - function testCopyXMLLangToLang() { - $this->assertResult( - array('xml:lang' => 'en'), - array('xml:lang' => 'en', 'lang' => 'en') - ); - } - - function testXMLLangOverridesLang() { - $this->assertResult( - array('lang' => 'fr', 'xml:lang' => 'de'), - array('lang' => 'de', 'xml:lang' => 'de') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/LengthTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/LengthTest.php deleted file mode 100644 index 3fbaa0ccf..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/LengthTest.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -class HTMLPurifier_AttrTransform_LengthTest extends HTMLPurifier_AttrTransformHarness -{ - - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_AttrTransform_Length('width'); - } - - function testEmptyInput() { - $this->assertResult( array() ); - } - - function testTransformPixel() { - $this->assertResult( - array('width' => '10'), - array('style' => 'width:10px;') - ); - } - - function testTransformPercentage() { - $this->assertResult( - array('width' => '10%'), - array('style' => 'width:10%;') - ); - } - - function testPrependNewCSS() { - $this->assertResult( - array('width' => '10%', 'style' => 'font-weight:bold'), - array('style' => 'width:10%;font-weight:bold') - ); - } - - function testLenientTreatmentOfInvalidInput() { - $this->assertResult( - array('width' => 'asdf'), - array('style' => 'width:asdf;') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/NameSyncTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/NameSyncTest.php deleted file mode 100644 index bae4a8d03..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/NameSyncTest.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -class HTMLPurifier_AttrTransform_NameSyncTest extends HTMLPurifier_AttrTransformHarness -{ - - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_AttrTransform_NameSync(); - $this->accumulator = new HTMLPurifier_IDAccumulator(); - $this->context->register('IDAccumulator', $this->accumulator); - $this->config->set('Attr.EnableID', true); - } - - function testEmpty() { - $this->assertResult( array() ); - } - - function testAllowSame() { - $this->assertResult( - array('name' => 'free', 'id' => 'free') - ); - } - - function testAllowDifferent() { - $this->assertResult( - array('name' => 'tryit', 'id' => 'thisgood') - ); - } - - function testCheckName() { - $this->accumulator->add('notok'); - $this->assertResult( - array('name' => 'notok', 'id' => 'ok'), - array('id' => 'ok') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/NameTest.php b/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/NameTest.php deleted file mode 100644 index 10e121238..000000000 --- a/lib/htmlpurifier/tests/HTMLPurifier/AttrTransform/NameTest.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -class HTMLPurifier_AttrTransform_NameTest extends HTMLPurifier_AttrTransformHarness -{ - - function setUp() { - parent::setUp(); - $this->obj = new HTMLPurifier_AttrTransform_Name(); - } - - function testEmpty() { - $this->assertResult( array() ); - } - - function testTransformNameToID() { - $this->assertResult( - array('name' => 'free'), - array('id' => 'free') - ); - } - - function testExistingIDOverridesName() { - $this->assertResult( - array('name' => 'tryit', 'id' => 'tobad'), - array('id' => 'tobad') - ); - } - -} - -// vim: et sw=4 sts=4 |