silverstripe-framework/tests/php/Core/HTMLCleanerTest.php
2016-11-23 19:25:12 +13:00

33 lines
671 B
PHP

<?php
use SilverStripe\Dev\SapphireTest;
use SilverStripe\View\Parsers\HTMLCleaner;
/**
* @package framework
* @subpackage tests
*/
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)');
}
}
}