mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-15 01:09:57 +09:00
merge from 1.6 ( html purifier lib )
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10579 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
8943ff97f3
commit
7ea7157ce7
813 changed files with 65203 additions and 0 deletions
50
classes/security/htmlpurifier/tests/HTMLPurifierTest.php
Normal file
50
classes/security/htmlpurifier/tests/HTMLPurifierTest.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
class HTMLPurifierTest extends HTMLPurifier_Harness
|
||||
{
|
||||
protected $purifier;
|
||||
|
||||
function testNull() {
|
||||
$this->assertPurification("Null byte\0", "Null byte");
|
||||
}
|
||||
|
||||
function test_purifyArray() {
|
||||
|
||||
$this->assertIdentical(
|
||||
$this->purifier->purifyArray(
|
||||
array('Good', '<b>Sketchy', 'foo' => '<script>bad</script>')
|
||||
),
|
||||
array('Good', '<b>Sketchy</b>', 'foo' => '')
|
||||
);
|
||||
|
||||
$this->assertIsA($this->purifier->context, 'array');
|
||||
|
||||
}
|
||||
|
||||
function testGetInstance() {
|
||||
$purifier = HTMLPurifier::getInstance();
|
||||
$purifier2 = HTMLPurifier::getInstance();
|
||||
$this->assertReference($purifier, $purifier2);
|
||||
}
|
||||
|
||||
function testMakeAbsolute() {
|
||||
$this->config->set('URI.Base', 'http://example.com/bar/baz.php');
|
||||
$this->config->set('URI.MakeAbsolute', true);
|
||||
$this->assertPurification(
|
||||
'<a href="foo.txt">Foobar</a>',
|
||||
'<a href="http://example.com/bar/foo.txt">Foobar</a>'
|
||||
);
|
||||
}
|
||||
|
||||
function test_addFilter_deprecated() {
|
||||
$this->expectError('HTMLPurifier->addFilter() is deprecated, use configuration directives in the Filter namespace or Filter.Custom');
|
||||
generate_mock_once('HTMLPurifier_Filter');
|
||||
$this->purifier->addFilter($mock = new HTMLPurifier_FilterMock());
|
||||
$mock->expectOnce('preFilter');
|
||||
$mock->expectOnce('postFilter');
|
||||
$this->purifier->purify('foo');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
Loading…
Add table
Add a link
Reference in a new issue