From 273a06d47d01493afabae60a604fa58484165652 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Mon, 19 Dec 2016 14:01:05 +0000 Subject: [PATCH] TEST Duplicated DataObjects dont keep Created date value --- tests/model/DataObjectDuplicationTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/model/DataObjectDuplicationTest.php b/tests/model/DataObjectDuplicationTest.php index 33650f3e5..e3b24fece 100644 --- a/tests/model/DataObjectDuplicationTest.php +++ b/tests/model/DataObjectDuplicationTest.php @@ -11,10 +11,11 @@ class DataObjectDuplicationTest extends SapphireTest { ); public function testDuplicate() { + SS_Datetime::set_mock_now('2016-01-01 01:01:01'); $orig = new DataObjectDuplicateTestClass1(); $orig->text = 'foo'; $orig->write(); - + SS_Datetime::set_mock_now('2016-01-02 01:01:01'); $duplicate = $orig->duplicate(); $this->assertInstanceOf('DataObjectDuplicateTestClass1', $duplicate, 'Creates the correct type' @@ -28,6 +29,8 @@ class DataObjectDuplicationTest extends SapphireTest { $this->assertEquals(2, DataObjectDuplicateTestClass1::get()->Count(), '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() {