2006-11-22 18:55:15 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_ChildDef_OptionalTest extends HTMLPurifier_ChildDefHarness
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00: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 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00: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 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testRemoveForbiddenText()
|
|
|
|
{
|
2006-11-22 18:55:15 +00:00
|
|
|
$this->assertResult('Not allowed text', '');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testEmpty()
|
|
|
|
{
|
2007-10-02 01:19:46 +00:00
|
|
|
$this->assertResult('');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testWhitespace()
|
|
|
|
{
|
2008-12-03 01:13:47 +00:00
|
|
|
$this->assertResult(' ');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testMultipleWhitespace()
|
|
|
|
{
|
2008-12-03 01:13:47 +00:00
|
|
|
$this->assertResult(' ');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-11-22 18:55:15 +00:00
|
|
|
}
|
2008-12-06 09:24:59 +00:00
|
|
|
|
|
|
|
// vim: et sw=4 sts=4
|