diff --git a/core/model/DataDifferencer.php b/core/model/DataDifferencer.php index 4846ff03e..d0dcf5857 100644 --- a/core/model/DataDifferencer.php +++ b/core/model/DataDifferencer.php @@ -65,7 +65,7 @@ class DataDifferencer extends ViewableData { function diffedData() { if($this->fromRecord) { $diffed = clone $this->fromRecord; - $fields = array_keys($diffed->getAllFields()); + $fields = array_keys($diffed->getAllFields() + $this->toRecord->getAllFields()); } else { $diffed = clone $this->toRecord; $fields = array_keys($this->toRecord->getAllFields()); diff --git a/tests/SiteTreeTest.php b/tests/SiteTreeTest.php index 35933a875..56e5df155 100755 --- a/tests/SiteTreeTest.php +++ b/tests/SiteTreeTest.php @@ -402,6 +402,24 @@ class SiteTreeTest extends SapphireTest { $this->objFromFixture('Member','editor')->logIn(); $this->assertTrue($page->canEdit()); } + + function testCompareVersions() { + $page = new Page(); + $page->write(); + $this->assertEquals(1, $page->Version); + + $page->Content = "

This is a test

"; + $page->write(); + $this->assertEquals(2, $page->Version); + + $diff = $page->compareVersions(1, 2); + + $processedContent = trim($diff->Content); + $processedContent = preg_replace('/\s*\s*/','>',$processedContent); + $this->assertEquals("

This is a test

", $processedContent); + + } function testAuthorIDAndPublisherIDFilledOutOnPublish() { // Ensure that we have a member ID who is doing all this work