2011-03-30 06:46:13 +02:00
|
|
|
<?php
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2016-10-14 03:30:05 +02:00
|
|
|
namespace SilverStripe\Core\Tests;
|
|
|
|
|
2016-08-19 00:51:35 +02:00
|
|
|
use SilverStripe\Dev\SapphireTest;
|
|
|
|
use SilverStripe\View\Parsers\HTMLCleaner;
|
|
|
|
|
2011-03-30 06:46:13 +02:00
|
|
|
class HTMLCleanerTest extends SapphireTest {
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testHTMLClean() {
|
2011-03-30 06:46:13 +02:00
|
|
|
$cleaner = HTMLCleaner::inst();
|
|
|
|
|
|
|
|
if ($cleaner) {
|
|
|
|
$this->assertEquals(
|
2012-10-16 06:10:54 +02:00
|
|
|
$cleaner->cleanHTML('<p>wrong <b>nesting</i></p>'),
|
|
|
|
'<p>wrong <b>nesting</b></p>',
|
2011-03-30 06:46:13 +02:00
|
|
|
"HTML cleaned properly"
|
|
|
|
);
|
|
|
|
$this->assertEquals(
|
2012-10-16 06:10:54 +02:00
|
|
|
$cleaner->cleanHTML('<p>unclosed paragraph'),
|
|
|
|
'<p>unclosed paragraph</p>',
|
2011-03-30 06:46:13 +02:00
|
|
|
"HTML cleaned properly"
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
$this->markTestSkipped('No HTMLCleaner library available (tidy or HTMLBeautifier)');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-24 04:04:52 +01:00
|
|
|
}
|