function EntityTestDateRangeTest::createEntity

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

Overrides EntityTestResourceTestBase::createEntity

File

core/modules/datetime_range/tests/src/Functional/EntityResource/EntityTest/EntityTestDateRangeTest.php, line 79

Class

EntityTestDateRangeTest
Tests the 'daterange' field's normalization.

Namespace

Drupal\Tests\datetime_range\Functional\EntityResource\EntityTest

Code

protected function createEntity() {
    $entity_test = EntityTest::create([
        'name' => 'Llama',
        'type' => static::$entityTypeId,
    ]);
    $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.