You are here

protected function EntityTestDatetimeTest::createEntity in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php \Drupal\Tests\datetime\Functional\EntityResource\EntityTest\EntityTestDatetimeTest::createEntity()
  2. 10 core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php \Drupal\Tests\datetime\Functional\EntityResource\EntityTest\EntityTestDatetimeTest::createEntity()

Creates the entity to be tested.

Return value

\Drupal\Core\Entity\EntityInterface The entity to be tested.

Overrides EntityTestResourceTestBase::createEntity

File

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

Class

EntityTestDatetimeTest
Tests the datetime field constraint with 'datetime' 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;
}