diff --git a/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php b/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php index 0c75233..c0937d7 100644 --- a/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php +++ b/core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php @@ -68,6 +68,14 @@ public function setUp() { $this->entity->save(); } + public function testWTF() { + $value = $this->entity->field_datetime->value; + $date = $this->entity->field_datetime->date; + + $this->assertEquals(static::$dateString, $value); + $this->assertEquals(static::$dateString . '+00:00', $date->format('c')); + } + /** * {@inheritdoc} */ @@ -90,7 +98,7 @@ protected function getExpectedNormalizedEntity() { return parent::getExpectedNormalizedEntity() + [ static::$fieldName => [ [ - 'value' => '2017-03-01T20:02:00+11:00', + 'value' => static::$dateString . '+11:00', ], ], ]; diff --git a/core/modules/rest/tests/src/Functional/BcTimestampNormalizerUnixTestTrait.php b/core/modules/rest/tests/src/Functional/BcTimestampNormalizerUnixTestTrait.php index ae0668a..3ba5d32 100644 --- a/core/modules/rest/tests/src/Functional/BcTimestampNormalizerUnixTestTrait.php +++ b/core/modules/rest/tests/src/Functional/BcTimestampNormalizerUnixTestTrait.php @@ -29,9 +29,11 @@ protected function formatExpectedTimestampItemValues($timestamp) { // Otherwise, format the date string to the same that // \Drupal\serialization\Normalizer\TimestampItemNormalizer will produce. + // 'Australia/Sydney' is the default time zone for tests. It is hardcoded + // here for test cases where the config isn't available. $date = new \DateTime(); $date->setTimestamp($timestamp); - $date->setTimezone(new \DateTimeZone($this->config('system.date')->get('timezone.default'))); + $date->setTimezone(new \DateTimeZone('Australia/Sydney')); // Format is also added to the expected return values. return [