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)
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:
parent
efd9b2f666
commit
b82640cf62
@ -65,7 +65,7 @@ class DataDifferencer extends ViewableData {
|
|||||||
function diffedData() {
|
function diffedData() {
|
||||||
if($this->fromRecord) {
|
if($this->fromRecord) {
|
||||||
$diffed = clone $this->fromRecord;
|
$diffed = clone $this->fromRecord;
|
||||||
$fields = array_keys($diffed->getAllFields());
|
$fields = array_keys($diffed->getAllFields() + $this->toRecord->getAllFields());
|
||||||
} else {
|
} else {
|
||||||
$diffed = clone $this->toRecord;
|
$diffed = clone $this->toRecord;
|
||||||
$fields = array_keys($this->toRecord->getAllFields());
|
$fields = array_keys($this->toRecord->getAllFields());
|
||||||
|
@ -402,6 +402,24 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
$this->objFromFixture('Member','editor')->logIn();
|
$this->objFromFixture('Member','editor')->logIn();
|
||||||
$this->assertTrue($page->canEdit());
|
$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() {
|
function testAuthorIDAndPublisherIDFilledOutOnPublish() {
|
||||||
// Ensure that we have a member ID who is doing all this work
|
// Ensure that we have a member ID who is doing all this work
|
||||||
|
Loading…
x
Reference in New Issue
Block a user