mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
TEST Duplicated DataObjects dont keep Created date value
This commit is contained in:
parent
eecdf56b36
commit
273a06d47d
@ -11,10 +11,11 @@ class DataObjectDuplicationTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
public function testDuplicate() {
|
public function testDuplicate() {
|
||||||
|
SS_Datetime::set_mock_now('2016-01-01 01:01:01');
|
||||||
$orig = new DataObjectDuplicateTestClass1();
|
$orig = new DataObjectDuplicateTestClass1();
|
||||||
$orig->text = 'foo';
|
$orig->text = 'foo';
|
||||||
$orig->write();
|
$orig->write();
|
||||||
|
SS_Datetime::set_mock_now('2016-01-02 01:01:01');
|
||||||
$duplicate = $orig->duplicate();
|
$duplicate = $orig->duplicate();
|
||||||
$this->assertInstanceOf('DataObjectDuplicateTestClass1', $duplicate,
|
$this->assertInstanceOf('DataObjectDuplicateTestClass1', $duplicate,
|
||||||
'Creates the correct type'
|
'Creates the correct type'
|
||||||
@ -28,6 +29,8 @@ class DataObjectDuplicationTest extends SapphireTest {
|
|||||||
$this->assertEquals(2, DataObjectDuplicateTestClass1::get()->Count(),
|
$this->assertEquals(2, DataObjectDuplicateTestClass1::get()->Count(),
|
||||||
'Only creates a single duplicate'
|
'Only creates a single duplicate'
|
||||||
);
|
);
|
||||||
|
$this->assertEquals(SS_Datetime::now()->Nice(), $duplicate->dbObject('Created')->Nice());
|
||||||
|
$this->assertNotEquals($orig->dbObject('Created')->Nice(), $duplicate->dbObject('Created')->Nice());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDuplicateHasOne() {
|
public function testDuplicateHasOne() {
|
||||||
|
Loading…
Reference in New Issue
Block a user