aboutsummaryrefslogtreecommitdiffstats
path: root/lib/htmlpurifier/tests/HTMLPurifier/URIFilter/HostBlacklistTest.php
blob: 4af5a6009df6fec85a71f63e7f53ec755de3abd9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

class HTMLPurifier_URIFilter_HostBlacklistTest extends HTMLPurifier_URIFilterHarness
{

    function setUp() {
        parent::setUp();
        $this->filter = new HTMLPurifier_URIFilter_HostBlacklist();
    }

    function testRejectBlacklistedHost() {
        $this->config->set('URI.HostBlacklist', 'example.com');
        $this->assertFiltering('http://example.com', false);
    }

    function testRejectBlacklistedHostThoughNotTrue() {
        // maybe this behavior should change
        $this->config->set('URI.HostBlacklist', 'example.com');
        $this->assertFiltering('http://example.comcast.com', false);
    }

    function testPreserveNonBlacklistedHost() {
        $this->config->set('URI.HostBlacklist', 'example.com');
        $this->assertFiltering('http://google.com');
    }

}

// vim: et sw=4 sts=4