3 class HTMLPurifierTest
extends HTMLPurifier_Harness
8 $this->assertPurification("Null byte\0", "Null byte");
11 function test_purifyArray() {
13 $this->assertIdentical(
14 $this->purifier
->purifyArray(
15 array('Good', '<b>Sketchy', 'foo' => '<script>bad</script>')
17 array('Good', '<b>Sketchy</b>', 'foo' => '')
20 $this->assertIsA($this->purifier
->context
, 'array');
24 function testGetInstance() {
25 $purifier = HTMLPurifier
::getInstance();
26 $purifier2 = HTMLPurifier
::getInstance();
27 $this->assertReference($purifier, $purifier2);
30 function testMakeAbsolute() {
31 $this->config
->set('URI.Base', 'http://example.com/bar/baz.php');
32 $this->config
->set('URI.MakeAbsolute', true);
33 $this->assertPurification(
34 '<a href="foo.txt">Foobar</a>',
35 '<a href="http://example.com/bar/foo.txt">Foobar</a>'
39 function testDisableResources() {
40 $this->config
->set('URI.DisableResources', true);
41 $this->assertPurification('<img src="foo.jpg" />', '');
44 function test_addFilter_deprecated() {
45 $this->expectError('HTMLPurifier->addFilter() is deprecated, use configuration directives in the Filter namespace or Filter.Custom');
46 generate_mock_once('HTMLPurifier_Filter');
47 $this->purifier
->addFilter($mock = new HTMLPurifier_FilterMock());
48 $mock->expectOnce('preFilter');
49 $mock->expectOnce('postFilter');
50 $this->purifier
->purify('foo');