function EntityTestDateOnlyTest::createEntity

Same name in other branches
  1. 9 core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDateonlyTest.php \Drupal\Tests\datetime\Functional\EntityResource\EntityTest\EntityTestDateonlyTest::createEntity()
  2. 8.9.x core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDateonlyTest.php \Drupal\Tests\datetime\Functional\EntityResource\EntityTest\EntityTestDateonlyTest::createEntity()
  3. 11.x core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDateOnlyTest.php \Drupal\Tests\datetime\Functional\EntityResource\EntityTest\EntityTestDateOnlyTest::createEntity()

Overrides EntityTestResourceTestBase::createEntity

File

core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDateOnlyTest.php, line 81

Class

EntityTestDateOnlyTest
Tests the datetime field constraint with 'date' items.

Namespace

Drupal\Tests\datetime\Functional\EntityResource\EntityTest

Code

protected function createEntity() {
    $entity_test = EntityTest::create([
        'name' => 'Llama',
        'type' => static::$entityTypeId,
        static::$fieldName => static::$dateString,
    ]);
    $entity_test->setOwnerId(0);
    $entity_test->save();
    return $entity_test;
}

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