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 test_addFilter_deprecated() {
40 $this->expectError('HTMLPurifier->addFilter() is deprecated, use configuration directives in the Filter namespace or Filter.Custom');
41 generate_mock_once('HTMLPurifier_Filter');
42 $this->purifier
->addFilter($mock = new HTMLPurifier_FilterMock());
43 $mock->expectOnce('preFilter');
44 $mock->expectOnce('postFilter');
45 $this->purifier
->purify('foo');