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

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102361 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-12 02:32:34 +00:00
parent 41a1d19329
commit 43fb34a748
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