function EntityTestDatetimeTest::getNormalizedPatchEntity

Overrides EntityResourceTestBase::getNormalizedPatchEntity

File

core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php, line 120

Class

EntityTestDatetimeTest
Tests the datetime field constraint with 'datetime' items.

Namespace

Drupal\Tests\datetime\Functional\EntityResource\EntityTest

Code

protected function getNormalizedPatchEntity() {
    return parent::getNormalizedPostEntity() + [
        static::$fieldName => [
            [
                // Omitting the timezone is allowed, this should result in the site's
                // timezone being used automatically. This does not make sense, but
                // it's how it functioned in the past, so we explicitly test this to
                // guarantee backward compatibility. ::getNormalizedPostEntity() tests
                // the recommended case, this tests backward compatibility.
'value' => static::$dateString,
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.