1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-31 03:10:09 +02:00

PSR-2 reformatting PHPDoc corrections

With minor corrections.

Signed-off-by: Marcus Bointon <marcus@synchromedia.co.uk>
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
Marcus Bointon
2013-07-16 13:56:14 +02:00
committed by Edward Z. Yang
parent 19eee14899
commit fac747bdbd
433 changed files with 13302 additions and 6690 deletions

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_CSS_AlphaValueTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_CSS_AlphaValue();
$this->assertDef('0');

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_CSS_BackgroundPositionTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_CSS_BackgroundPosition();
// explicitly cited in spec

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_CSS_BackgroundTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$config = HTMLPurifier_Config::createDefault();
$this->def = new HTMLPurifier_AttrDef_CSS_Background($config);

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_CSS_BorderTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$config = HTMLPurifier_Config::createDefault();
$this->def = new HTMLPurifier_AttrDef_CSS_Border($config);

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_CSS_ColorTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_CSS_Color();
$this->assertDef('#F00');

View File

@@ -5,7 +5,8 @@ class HTMLPurifier_AttrDef_CSS_Composite_Testable extends
{
// we need to pass by ref to get the mocks in
function HTMLPurifier_AttrDef_CSS_Composite_Testable(&$defs) {
public function HTMLPurifier_AttrDef_CSS_Composite_Testable(&$defs)
{
$this->defs =& $defs;
}
@@ -16,8 +17,8 @@ class HTMLPurifier_AttrDef_CSS_CompositeTest extends HTMLPurifier_AttrDefHarness
protected $def1, $def2;
function test() {
public function test()
{
generate_mock_once('HTMLPurifier_AttrDef');
$config = HTMLPurifier_Config::createDefault();

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_CSS_FilterTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_CSS_Filter();
$this->assertDef('none');

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_CSS_FontFamilyTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_CSS_FontFamily();
$this->assertDef('Gill, Helvetica, sans-serif');
@@ -36,7 +36,8 @@ class HTMLPurifier_AttrDef_CSS_FontFamilyTest extends HTMLPurifier_AttrDefHarnes
//$this->assertDef('"\'"', "\"'\"");
}
function testAllowed() {
public function testAllowed()
{
$this->config->set('CSS.AllowedFonts', array('serif', 'Times New Roman'));
$this->assertDef('serif');

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_CSS_FontTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$config = HTMLPurifier_Config::createDefault();
$this->def = new HTMLPurifier_AttrDef_CSS_Font($config);

View File

@@ -6,39 +6,46 @@ class HTMLPurifier_AttrDef_CSS_ImportantDecoratorTest extends HTMLPurifier_AttrD
/** Mock AttrDef decorator is wrapping */
protected $mock;
function setUp() {
public function setUp()
{
generate_mock_once('HTMLPurifier_AttrDef');
$this->mock = new HTMLPurifier_AttrDefMock();
$this->def = new HTMLPurifier_AttrDef_CSS_ImportantDecorator($this->mock, true);
}
protected function setMock($input, $output = null) {
protected function setMock($input, $output = null)
{
if ($output === null) $output = $input;
$this->mock->expectOnce('validate', array($input, $this->config, $this->context));
$this->mock->setReturnValue('validate', $output);
}
function testImportant() {
public function testImportant()
{
$this->setMock('23');
$this->assertDef('23 !important');
}
function testImportantInternalDefChanged() {
public function testImportantInternalDefChanged()
{
$this->setMock('23', '24');
$this->assertDef('23 !important', '24 !important');
}
function testImportantWithSpace() {
public function testImportantWithSpace()
{
$this->setMock('23');
$this->assertDef('23 ! important ', '23 !important');
}
function testFakeImportant() {
public function testFakeImportant()
{
$this->setMock('! foo important');
$this->assertDef('! foo important');
}
function testStrip() {
public function testStrip()
{
$this->def = new HTMLPurifier_AttrDef_CSS_ImportantDecorator($this->mock, false);
$this->setMock('23');
$this->assertDef('23 ! important ', '23');

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_CSS_LengthTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_CSS_Length();
$this->assertDef('0');
@@ -26,8 +26,8 @@ class HTMLPurifier_AttrDef_CSS_LengthTest extends HTMLPurifier_AttrDefHarness
}
function testNonNegative() {
public function testNonNegative()
{
$this->def = new HTMLPurifier_AttrDef_CSS_Length('0');
$this->assertDef('3cm');
@@ -35,7 +35,8 @@ class HTMLPurifier_AttrDef_CSS_LengthTest extends HTMLPurifier_AttrDefHarness
}
function testBounding() {
public function testBounding()
{
$this->def = new HTMLPurifier_AttrDef_CSS_Length('-1in', '1in');
$this->assertDef('1cm');
$this->assertDef('-1cm');

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_CSS_ListStyleTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$config = HTMLPurifier_Config::createDefault();
$this->def = new HTMLPurifier_AttrDef_CSS_ListStyle($config);

View File

@@ -4,7 +4,8 @@
class HTMLPurifier_AttrDef_CSS_MultipleTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_CSS_Multiple(
new HTMLPurifier_AttrDef_Integer()
);

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_CSS_NumberTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_CSS_Number();
$this->assertDef('0');
@@ -38,8 +38,8 @@ class HTMLPurifier_AttrDef_CSS_NumberTest extends HTMLPurifier_AttrDefHarness
}
function testNonNegative() {
public function testNonNegative()
{
$this->def = new HTMLPurifier_AttrDef_CSS_Number(true);
$this->assertDef('23');
$this->assertDef('-12', false);

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_CSS_PercentageTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_CSS_Percentage();
$this->assertDef('10%');

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_CSS_TextDecorationTest extends HTMLPurifier_AttrDefHarness
{
function testCaseInsensitive() {
public function testCaseInsensitive()
{
$this->def = new HTMLPurifier_AttrDef_CSS_TextDecoration();
$this->assertDef('none');

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_CSS_URITest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_CSS_URI();
$this->assertDef('', false);

View File

@@ -3,13 +3,14 @@
class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
{
function setup() {
public function setup()
{
parent::setup();
$this->def = new HTMLPurifier_AttrDef_CSS();
}
function test() {
public function test()
{
// regular cases, singular
$this->assertDef('text-align:right;');
$this->assertDef('border-left-style:solid;');
@@ -115,7 +116,8 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
}
function testProprietary() {
public function testProprietary()
{
$this->config->set('CSS.Proprietary', true);
$this->assertDef('scrollbar-arrow-color:#ff0;');
@@ -132,25 +134,29 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
}
function testImportant() {
public function testImportant()
{
$this->config->set('CSS.AllowImportant', true);
$this->assertDef('float:left !important;');
}
function testTricky() {
public function testTricky()
{
$this->config->set('CSS.AllowTricky', true);
$this->assertDef('display:none;');
$this->assertDef('visibility:visible;');
$this->assertDef('overflow:scroll;');
}
function testForbidden() {
public function testForbidden()
{
$this->config->set('CSS.ForbiddenProperties', 'float');
$this->assertDef('float:left;', false);
$this->assertDef('text-align:right;');
}
function testTrusted() {
public function testTrusted()
{
$this->config->set('CSS.Trusted', true);
$this->assertDef('position:relative;');
$this->assertDef('left:2px;');

View File

@@ -3,24 +3,28 @@
class HTMLPurifier_AttrDef_EnumTest extends HTMLPurifier_AttrDefHarness
{
function testCaseInsensitive() {
public function testCaseInsensitive()
{
$this->def = new HTMLPurifier_AttrDef_Enum(array('one', 'two'));
$this->assertDef('one');
$this->assertDef('ONE', 'one');
}
function testCaseSensitive() {
public function testCaseSensitive()
{
$this->def = new HTMLPurifier_AttrDef_Enum(array('one', 'two'), true);
$this->assertDef('one');
$this->assertDef('ONE', false);
}
function testFixing() {
public function testFixing()
{
$this->def = new HTMLPurifier_AttrDef_Enum(array('one'));
$this->assertDef(' one ', 'one');
}
function test_make() {
public function test_make()
{
$factory = new HTMLPurifier_AttrDef_Enum();
$def = $factory->make('foo,bar');

View File

@@ -3,14 +3,16 @@
class HTMLPurifier_AttrDef_HTML_BoolTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_HTML_Bool('foo');
$this->assertDef('foo');
$this->assertDef('', false);
$this->assertDef('bar', 'foo');
}
function test_make() {
public function test_make()
{
$factory = new HTMLPurifier_AttrDef_HTML_Bool();
$def = $factory->make('foo');
$def2 = new HTMLPurifier_AttrDef_HTML_Bool('foo');

View File

@@ -2,23 +2,27 @@
class HTMLPurifier_AttrDef_HTML_ClassTest extends HTMLPurifier_AttrDef_HTML_NmtokensTest
{
function setUp() {
public function setUp()
{
parent::setUp();
$this->def = new HTMLPurifier_AttrDef_HTML_Class();
}
function testAllowedClasses() {
public function testAllowedClasses()
{
$this->config->set('Attr.AllowedClasses', array('foo'));
$this->assertDef('foo');
$this->assertDef('bar', false);
$this->assertDef('foo bar', 'foo');
}
function testForbiddenClasses() {
public function testForbiddenClasses()
{
$this->config->set('Attr.ForbiddenClasses', array('bar'));
$this->assertDef('foo');
$this->assertDef('bar', false);
$this->assertDef('foo bar', 'foo');
}
function testDefault() {
public function testDefault()
{
$this->assertDef('valid');
$this->assertDef('a0-_');
$this->assertDef('-valid');
@@ -40,7 +44,8 @@ class HTMLPurifier_AttrDef_HTML_ClassTest extends HTMLPurifier_AttrDef_HTML_Nmto
// test duplicate removal
$this->assertDef('valid valid', 'valid');
}
function testXHTML11Behavior() {
public function testXHTML11Behavior()
{
$this->config->set('HTML.Doctype', 'XHTML 1.1');
$this->assertDef('0invalid', false);
$this->assertDef('valid valid', 'valid');

View File

@@ -3,7 +3,8 @@
class HTMLPurifier_AttrDef_HTML_ColorTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_HTML_Color();
$this->assertDef('', false);
$this->assertDef('foo', false);

View File

@@ -3,19 +3,22 @@
class HTMLPurifier_AttrDef_HTML_FrameTargetTest extends HTMLPurifier_AttrDefHarness
{
function setup() {
public function setup()
{
parent::setup();
$this->def = new HTMLPurifier_AttrDef_HTML_FrameTarget();
}
function testNoneAllowed() {
public function testNoneAllowed()
{
$this->assertDef('', false);
$this->assertDef('foo', false);
$this->assertDef('_blank', false);
$this->assertDef('baz', false);
}
function test() {
public function test()
{
$this->config->set('Attr.AllowedFrameTargets', 'foo,_blank');
$this->assertDef('', false);
$this->assertDef('foo');

View File

@@ -3,7 +3,8 @@
class HTMLPurifier_AttrDef_HTML_IDTest extends HTMLPurifier_AttrDefHarness
{
function setUp() {
public function setUp()
{
parent::setUp();
$id_accumulator = new HTMLPurifier_IDAccumulator();
@@ -13,8 +14,8 @@ class HTMLPurifier_AttrDef_HTML_IDTest extends HTMLPurifier_AttrDefHarness
}
function test() {
public function test()
{
// valid ID names
$this->assertDef('alpha');
$this->assertDef('al_ha');
@@ -35,8 +36,8 @@ class HTMLPurifier_AttrDef_HTML_IDTest extends HTMLPurifier_AttrDefHarness
}
function testPrefix() {
public function testPrefix()
{
$this->config->set('Attr.IDPrefix', 'user_');
$this->assertDef('alpha', 'user_alpha');
@@ -50,8 +51,8 @@ class HTMLPurifier_AttrDef_HTML_IDTest extends HTMLPurifier_AttrDefHarness
}
function testTwoPrefixes() {
public function testTwoPrefixes()
{
$this->config->set('Attr.IDPrefix', 'user_');
$this->config->set('Attr.IDPrefixLocal', 'story95_');
@@ -64,7 +65,8 @@ class HTMLPurifier_AttrDef_HTML_IDTest extends HTMLPurifier_AttrDefHarness
$this->assertDef('user_alas', 'user_story95_user_alas'); // !
}
function testLocalPrefixWithoutMainPrefix() {
public function testLocalPrefixWithoutMainPrefix()
{
// no effect when IDPrefix isn't set
$this->config->set('Attr.IDPrefix', '');
$this->config->set('Attr.IDPrefixLocal', 'story95_');
@@ -75,8 +77,8 @@ class HTMLPurifier_AttrDef_HTML_IDTest extends HTMLPurifier_AttrDefHarness
}
// reference functionality is disabled for now
function disabled_testIDReference() {
public function disabled_testIDReference()
{
$this->def = new HTMLPurifier_AttrDef_HTML_ID(true);
$this->assertDef('good_id');
@@ -94,8 +96,8 @@ class HTMLPurifier_AttrDef_HTML_IDTest extends HTMLPurifier_AttrDefHarness
}
function testRegexp() {
public function testRegexp()
{
$this->config->set('Attr.IDBlacklistRegexp', '/^g_/');
$this->assertDef('good_id');

View File

@@ -3,12 +3,13 @@
class HTMLPurifier_AttrDef_HTML_LengthTest extends HTMLPurifier_AttrDef_HTML_PixelsTest
{
function setup() {
public function setup()
{
$this->def = new HTMLPurifier_AttrDef_HTML_Length();
}
function test() {
public function test()
{
// pixel check
parent::test();

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_HTML_LinkTypesTest extends HTMLPurifier_AttrDefHarness
{
function testNull() {
public function testNull()
{
$this->def = new HTMLPurifier_AttrDef_HTML_LinkTypes('rel');
$this->config->set('Attr.AllowedRel', array('nofollow', 'foo'));

View File

@@ -3,12 +3,13 @@
class HTMLPurifier_AttrDef_HTML_MultiLengthTest extends HTMLPurifier_AttrDef_HTML_LengthTest
{
function setup() {
public function setup()
{
$this->def = new HTMLPurifier_AttrDef_HTML_MultiLength();
}
function test() {
public function test()
{
// length check
parent::test();

View File

@@ -3,13 +3,14 @@
class HTMLPurifier_AttrDef_HTML_NmtokensTest extends HTMLPurifier_AttrDefHarness
{
function setUp() {
public function setUp()
{
parent::setUp();
$this->def = new HTMLPurifier_AttrDef_HTML_Nmtokens();
}
function testDefault() {
public function testDefault()
{
$this->assertDef('valid');
$this->assertDef('a0-_');
$this->assertDef('-valid');

View File

@@ -3,12 +3,13 @@
class HTMLPurifier_AttrDef_HTML_PixelsTest extends HTMLPurifier_AttrDefHarness
{
function setup() {
public function setup()
{
$this->def = new HTMLPurifier_AttrDef_HTML_Pixels();
}
function test() {
public function test()
{
$this->assertDef('1');
$this->assertDef('0');
@@ -33,7 +34,8 @@ class HTMLPurifier_AttrDef_HTML_PixelsTest extends HTMLPurifier_AttrDefHarness
}
function test_make() {
public function test_make()
{
$factory = new HTMLPurifier_AttrDef_HTML_Pixels();
$this->def = $factory->make('30');
$this->assertDef('25');

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_IntegerTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_Integer();
$this->assertDef('0');
@@ -23,7 +23,8 @@ class HTMLPurifier_AttrDef_IntegerTest extends HTMLPurifier_AttrDefHarness
}
function assertRange($negative, $zero, $positive) {
public function assertRange($negative, $zero, $positive)
{
$this->assertDef('-100', $negative);
$this->assertDef('-1', $negative);
$this->assertDef('0', $zero);
@@ -31,8 +32,8 @@ class HTMLPurifier_AttrDef_IntegerTest extends HTMLPurifier_AttrDefHarness
$this->assertDef('42', $positive);
}
function testRange() {
public function testRange()
{
$this->def = new HTMLPurifier_AttrDef_Integer(false);
$this->assertRange(false, true, true); // non-negative

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_LangTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_Lang();
// basic good uses

View File

@@ -5,7 +5,8 @@ class HTMLPurifier_AttrDef_SwitchTest extends HTMLPurifier_AttrDefHarness
protected $with, $without;
function setUp() {
public function setUp()
{
parent::setUp();
generate_mock_once('HTMLPurifier_AttrDef');
$this->with = new HTMLPurifier_AttrDefMock();
@@ -13,7 +14,8 @@ class HTMLPurifier_AttrDef_SwitchTest extends HTMLPurifier_AttrDefHarness
$this->def = new HTMLPurifier_AttrDef_Switch('tag', $this->with, $this->without);
}
function testWith() {
public function testWith()
{
$token = new HTMLPurifier_Token_Start('tag');
$this->context->register('CurrentToken', $token);
$this->with->expectOnce('validate');
@@ -21,7 +23,8 @@ class HTMLPurifier_AttrDef_SwitchTest extends HTMLPurifier_AttrDefHarness
$this->assertDef('bar', 'foo');
}
function testWithout() {
public function testWithout()
{
$token = new HTMLPurifier_Token_Start('other-tag');
$this->context->register('CurrentToken', $token);
$this->without->expectOnce('validate');

View File

@@ -3,8 +3,8 @@
class HTMLPurifier_AttrDef_TextTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_Text();
$this->assertDef('This is spiffy text!');

View File

@@ -4,7 +4,8 @@ class HTMLPurifier_AttrDef_URI_Email_SimpleCheckTest
extends HTMLPurifier_AttrDef_URI_EmailHarness
{
function setUp() {
public function setUp()
{
$this->def = new HTMLPurifier_AttrDef_URI_Email_SimpleCheck();
}

View File

@@ -6,7 +6,8 @@ class HTMLPurifier_AttrDef_URI_EmailHarness extends HTMLPurifier_AttrDefHarness
/**
* Tests common email strings that are obviously pass/fail
*/
function testCore() {
public function testCore()
{
$this->assertDef('bob@example.com');
$this->assertDef(' bob@example.com ', 'bob@example.com');
$this->assertDef('bob.thebuilder@example.net');

View File

@@ -6,8 +6,8 @@
class HTMLPurifier_AttrDef_URI_HostTest extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_URI_Host();
$this->assertDef('[2001:DB8:0:0:8:800:200C:417A]'); // IPv6
@@ -40,7 +40,8 @@ class HTMLPurifier_AttrDef_URI_HostTest extends HTMLPurifier_AttrDefHarness
}
function testIDNA() {
public function testIDNA()
{
if (!$GLOBALS['HTMLPurifierTest']['Net_IDNA2']) {
return false;
}

View File

@@ -6,8 +6,8 @@
class HTMLPurifier_AttrDef_URI_IPv4Test extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_URI_IPv4();
$this->assertDef('127.0.0.1'); // standard IPv4, loopback, non-routable

View File

@@ -6,8 +6,8 @@
class HTMLPurifier_AttrDef_URI_IPv6Test extends HTMLPurifier_AttrDefHarness
{
function test() {
public function test()
{
$this->def = new HTMLPurifier_AttrDef_URI_IPv6();
$this->assertDef('2001:DB8:0:0:8:800:200C:417A'); // unicast, full

View File

@@ -6,12 +6,14 @@
class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
{
function setUp() {
public function setUp()
{
$this->def = new HTMLPurifier_AttrDef_URI();
parent::setUp();
}
function testIntegration() {
public function testIntegration()
{
$this->assertDef('http://www.google.com/');
$this->assertDef('http:', '');
$this->assertDef('http:/foo', '/foo');
@@ -22,33 +24,38 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
$this->assertDef('mailto:bob@example.com');
}
function testIntegrationWithPercentEncoder() {
public function testIntegrationWithPercentEncoder()
{
$this->assertDef(
'http://www.example.com/%56%fc%GJ%5%FC',
'http://www.example.com/V%FC%25GJ%255%FC'
);
}
function testPercentEncoding() {
public function testPercentEncoding()
{
$this->assertDef(
'http:colon:mercenary',
'colon%3Amercenary'
);
}
function testPercentEncodingPreserve() {
public function testPercentEncodingPreserve()
{
$this->assertDef(
'http://www.example.com/abcABC123-_.!~*()\''
);
}
function testEmbeds() {
public function testEmbeds()
{
$this->def = new HTMLPurifier_AttrDef_URI(true);
$this->assertDef('http://sub.example.com/alas?foo=asd');
$this->assertDef('mailto:foo@example.com', false);
}
function testConfigMunge() {
public function testConfigMunge()
{
$this->config->set('URI.Munge', 'http://www.google.com/url?q=%s');
$this->assertDef(
'http://www.example.com/',
@@ -58,32 +65,39 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
$this->assertDef('javascript:foobar();', false);
}
function testDefaultSchemeRemovedInBlank() {
public function testDefaultSchemeRemovedInBlank()
{
$this->assertDef('http:', '');
}
function testDefaultSchemeRemovedInRelativeURI() {
public function testDefaultSchemeRemovedInRelativeURI()
{
$this->assertDef('http:/foo/bar', '/foo/bar');
}
function testDefaultSchemeNotRemovedInAbsoluteURI() {
public function testDefaultSchemeNotRemovedInAbsoluteURI()
{
$this->assertDef('http://example.com/foo/bar');
}
function testAltSchemeNotRemoved() {
public function testAltSchemeNotRemoved()
{
$this->assertDef('mailto:this-looks-like-a-path@example.com');
}
function testResolveNullSchemeAmbiguity() {
public function testResolveNullSchemeAmbiguity()
{
$this->assertDef('///foo', '/foo');
}
function testResolveNullSchemeDoubleAmbiguity() {
public function testResolveNullSchemeDoubleAmbiguity()
{
$this->config->set('URI.Host', 'example.com');
$this->assertDef('////foo', '//example.com//foo');
}
function testURIDefinitionValidation() {
public function testURIDefinitionValidation()
{
$parser = new HTMLPurifier_URIParser();
$uri = $parser->parse('http://example.com');
$this->config->set('URI.DefinitionID', 'HTMLPurifier_AttrDef_URITest->testURIDefinitionValidation');
@@ -116,7 +130,8 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
HTMLPurifier_DefinitionCacheFactory::instance($old);
}
function test_make() {
public function test_make()
{
$factory = new HTMLPurifier_AttrDef_URI();
$def = $factory->make('');
$def2 = new HTMLPurifier_AttrDef_URI();
@@ -128,8 +143,8 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
}
/*
function test_validate_configWhitelist() {
public function test_validate_configWhitelist()
{
$this->config->set('URI.HostPolicy', 'DenyAll');
$this->config->set('URI.HostWhitelist', array(null, 'google.com'));