mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-09-19 10:45:18 +00:00
fac747bdbd
With minor corrections. Signed-off-by: Marcus Bointon <marcus@synchromedia.co.uk> Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
61 lines
1.3 KiB
PHP
61 lines
1.3 KiB
PHP
<?php
|
|
|
|
class HTMLPurifier_URIFilter_DisableExternalTest extends HTMLPurifier_URIFilterHarness
|
|
{
|
|
|
|
public function setUp()
|
|
{
|
|
parent::setUp();
|
|
$this->filter = new HTMLPurifier_URIFilter_DisableExternal();
|
|
}
|
|
|
|
public function testRemoveExternal()
|
|
{
|
|
$this->assertFiltering(
|
|
'http://example.com', false
|
|
);
|
|
}
|
|
|
|
public function testPreserveInternal()
|
|
{
|
|
$this->assertFiltering(
|
|
'/foo/bar'
|
|
);
|
|
}
|
|
|
|
public function testPreserveOurHost()
|
|
{
|
|
$this->config->set('URI.Host', 'example.com');
|
|
$this->assertFiltering(
|
|
'http://example.com'
|
|
);
|
|
}
|
|
|
|
public function testPreserveOurSubdomain()
|
|
{
|
|
$this->config->set('URI.Host', 'example.com');
|
|
$this->assertFiltering(
|
|
'http://www.example.com'
|
|
);
|
|
}
|
|
|
|
public function testRemoveSuperdomain()
|
|
{
|
|
$this->config->set('URI.Host', 'www.example.com');
|
|
$this->assertFiltering(
|
|
'http://example.com', false
|
|
);
|
|
}
|
|
|
|
public function testBaseAsHost()
|
|
{
|
|
$this->config->set('URI.Base', 'http://www.example.com/foo/bar');
|
|
$this->assertFiltering(
|
|
'http://www.example.com/baz'
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
// vim: et sw=4 sts=4
|