2007-08-02 01:12:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_URIFilter_DisableExternalTest extends HTMLPurifier_URIFilterHarness
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function setUp()
|
|
|
|
{
|
2007-08-02 01:12:27 +00:00
|
|
|
parent::setUp();
|
|
|
|
$this->filter = new HTMLPurifier_URIFilter_DisableExternal();
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testRemoveExternal()
|
|
|
|
{
|
2007-08-02 01:12:27 +00:00
|
|
|
$this->assertFiltering(
|
|
|
|
'http://example.com', false
|
|
|
|
);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testPreserveInternal()
|
|
|
|
{
|
2007-08-02 01:12:27 +00:00
|
|
|
$this->assertFiltering(
|
|
|
|
'/foo/bar'
|
|
|
|
);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testPreserveOurHost()
|
|
|
|
{
|
2009-02-20 00:17:49 +00:00
|
|
|
$this->config->set('URI.Host', 'example.com');
|
2007-08-02 01:12:27 +00:00
|
|
|
$this->assertFiltering(
|
|
|
|
'http://example.com'
|
|
|
|
);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testPreserveOurSubdomain()
|
|
|
|
{
|
2009-02-20 00:17:49 +00:00
|
|
|
$this->config->set('URI.Host', 'example.com');
|
2007-08-02 01:12:27 +00:00
|
|
|
$this->assertFiltering(
|
|
|
|
'http://www.example.com'
|
|
|
|
);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testRemoveSuperdomain()
|
|
|
|
{
|
2009-02-20 00:17:49 +00:00
|
|
|
$this->config->set('URI.Host', 'www.example.com');
|
2007-08-02 01:12:27 +00:00
|
|
|
$this->assertFiltering(
|
|
|
|
'http://example.com', false
|
|
|
|
);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testBaseAsHost()
|
|
|
|
{
|
2009-02-20 00:17:49 +00:00
|
|
|
$this->config->set('URI.Base', 'http://www.example.com/foo/bar');
|
2008-07-10 22:46:46 +00:00
|
|
|
$this->assertFiltering(
|
|
|
|
'http://www.example.com/baz'
|
|
|
|
);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-08-02 01:12:27 +00:00
|
|
|
}
|
2008-12-06 09:24:59 +00:00
|
|
|
|
|
|
|
// vim: et sw=4 sts=4
|