public 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); // Use inline element to avoid double wrapping applied to // blocklevel elements depending on HTMLCleaner implementation: // <ins><p> gets converted to <ins><p><inst> $page->Content = "<span>This is a test</span>"; $page->write(); $this->assertEquals(2, $page->Version); $diff = $page->compareVersions(1, 2); $processedContent = trim($diff->Content); $processedContent = preg_replace('/\\s*</', '<', $processedContent); $processedContent = preg_replace('/>\\s*/', '>', $processedContent); $this->assertEquals("<ins><span>This is a test</span></ins>", $processedContent); Diff::$html_cleaner_class = $oldCleanerClass; }