diff --git a/tests/model/SiteTreeTest.php b/tests/model/SiteTreeTest.php index 8b2b0911..4ff67307 100755 --- a/tests/model/SiteTreeTest.php +++ b/tests/model/SiteTreeTest.php @@ -509,11 +509,18 @@ class SiteTreeTest extends SapphireTest { } function testCompareVersions() { + // Necessary to avoid + $oldCleanerClass = Diff::$html_cleaner_class; + Diff::$html_cleaner_class = 'SiteTreeTest_NullHtmlCleaner'; + $page = new Page(); $page->write(); $this->assertEquals(1, $page->Version); - - $page->Content = "

This is a test

"; + + // Use inline element to avoid double wrapping applied to + // blocklevel elements depending on HTMLCleaner implementation: + //

gets converted to

+ $page->Content = "This is a test"; $page->write(); $this->assertEquals(2, $page->Version); @@ -522,8 +529,9 @@ class SiteTreeTest extends SapphireTest { $processedContent = trim($diff->Content); $processedContent = preg_replace('/\s*\s*/','>',$processedContent); - $this->assertEquals("

This is a test

", $processedContent); + $this->assertEquals("This is a test", $processedContent); + Diff::$html_cleaner_class = $oldCleanerClass; } function testAuthorIDAndPublisherIDFilledOutOnPublish() { @@ -759,4 +767,8 @@ class SiteTreeTest_Conflicted_Controller extends Page_Controller implements Test } -/**#@-*/ +class SiteTreeTest_NullHtmlCleaner extends HTMLCleaner { + function cleanHTML($html) { + return $html; + } +} \ No newline at end of file