2006-11-22 18:55:15 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_ChildDef_OptionalTest extends HTMLPurifier_ChildDefHarness
|
|
|
|
{
|
2008-12-06 02:28:20 -05:00
|
|
|
|
2013-07-16 13:56:14 +02:00
|
|
|
public function setUp()
|
|
|
|
{
|
2007-08-06 06:22:23 +00:00
|
|
|
parent::setUp();
|
2006-11-22 18:55:15 +00:00
|
|
|
$this->obj = new HTMLPurifier_ChildDef_Optional('b | i');
|
2007-08-06 06:22:23 +00:00
|
|
|
}
|
2008-12-06 02:28:20 -05:00
|
|
|
|
2013-07-16 13:56:14 +02:00
|
|
|
public function testBasicUsage()
|
|
|
|
{
|
2006-11-22 18:55:15 +00:00
|
|
|
$this->assertResult('<b>Bold text</b><img />', '<b>Bold text</b>');
|
2007-08-06 06:22:23 +00:00
|
|
|
}
|
2008-12-06 02:28:20 -05:00
|
|
|
|
2013-07-16 13:56:14 +02:00
|
|
|
public function testRemoveForbiddenText()
|
|
|
|
{
|
2006-11-22 18:55:15 +00:00
|
|
|
$this->assertResult('Not allowed text', '');
|
|
|
|
}
|
2008-12-06 02:28:20 -05:00
|
|
|
|
2013-07-16 13:56:14 +02:00
|
|
|
public function testEmpty()
|
|
|
|
{
|
2007-10-02 01:19:46 +00:00
|
|
|
$this->assertResult('');
|
|
|
|
}
|
2008-12-06 02:28:20 -05:00
|
|
|
|
2013-07-16 13:56:14 +02:00
|
|
|
public function testWhitespace()
|
|
|
|
{
|
2008-12-02 20:13:47 -05:00
|
|
|
$this->assertResult(' ');
|
|
|
|
}
|
2008-12-06 02:28:20 -05:00
|
|
|
|
2013-07-16 13:56:14 +02:00
|
|
|
public function testMultipleWhitespace()
|
|
|
|
{
|
2008-12-02 20:13:47 -05:00
|
|
|
$this->assertResult(' ');
|
|
|
|
}
|
2008-12-06 02:28:20 -05:00
|
|
|
|
2006-11-22 18:55:15 +00:00
|
|
|
}
|
2008-12-06 04:24:59 -05:00
|
|
|
|
|
|
|
// vim: et sw=4 sts=4
|