mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
41a1d19329
commit
43fb34a748
@ -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());
|
||||
|
@ -403,6 +403,24 @@ class SiteTreeTest extends SapphireTest {
|
||||
$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
|
||||
$member = Member::currentUser();
|
||||
|
Loading…
x
Reference in New Issue
Block a user