mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-06 09:41:36 +02:00
31 lines
805 B
PHP
31 lines
805 B
PHP
<?php
|
|
|
|
namespace SilverStripe\Core\Tests;
|
|
|
|
use SilverStripe\Dev\SapphireTest;
|
|
use SilverStripe\View\Parsers\HTMLCleaner;
|
|
|
|
class HTMLCleanerTest extends SapphireTest
|
|
{
|
|
|
|
public function testHTMLClean()
|
|
{
|
|
$cleaner = HTMLCleaner::inst();
|
|
|
|
if ($cleaner) {
|
|
$this->assertEquals(
|
|
$cleaner->cleanHTML('<p>wrong <b>nesting</i></p>'),
|
|
'<p>wrong <b>nesting</b></p>',
|
|
"HTML cleaned properly"
|
|
);
|
|
$this->assertEquals(
|
|
$cleaner->cleanHTML('<p>unclosed paragraph'),
|
|
'<p>unclosed paragraph</p>',
|
|
"HTML cleaned properly"
|
|
);
|
|
} else {
|
|
$this->markTestSkipped('No HTMLCleaner library available (tidy or HTMLBeautifier)');
|
|
}
|
|
}
|
|
}
|