BUGFIX: Include newly set fields in the differences shown by DataDifferencer (from r90264)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@96736 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-01-12 23:17:02 +00:00
parent efd9b2f666
commit b82640cf62
2 changed files with 19 additions and 1 deletions

View File

@ -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());

View File

@ -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 = "<p>This is a test</p>";
$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><p>This is a test</p></ins>", $processedContent);
}
function testAuthorIDAndPublisherIDFilledOutOnPublish() {
// Ensure that we have a member ID who is doing all this work