function EntityViewDisplayResourceTestBase::createEntity

Same name in other branches
  1. 9 core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewDisplayResourceTestBase::createEntity()
  2. 10 core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewDisplayResourceTestBase::createEntity()
  3. 11.x core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewDisplayResourceTestBase::createEntity()

Overrides EntityResourceTestBase::createEntity

1 call to EntityViewDisplayResourceTestBase::createEntity()
LayoutBuilderEntityViewDisplayResourceTestBase::createEntity in core/modules/layout_builder/tests/src/Functional/Rest/LayoutBuilderEntityViewDisplayResourceTestBase.php
Creates the entity to be tested.
1 method overrides EntityViewDisplayResourceTestBase::createEntity()
LayoutBuilderEntityViewDisplayResourceTestBase::createEntity in core/modules/layout_builder/tests/src/Functional/Rest/LayoutBuilderEntityViewDisplayResourceTestBase.php
Creates the entity to be tested.

File

core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php, line 41

Class

EntityViewDisplayResourceTestBase

Namespace

Drupal\FunctionalTests\Rest

Code

protected function createEntity() {
    // Create a "Camelids" node type.
    $camelids = NodeType::create([
        'name' => 'Camelids',
        'type' => 'camelids',
    ]);
    $camelids->save();
    // Create a view display.
    $view_display = EntityViewDisplay::create([
        'targetEntityType' => 'node',
        'bundle' => 'camelids',
        'mode' => 'default',
        'status' => TRUE,
    ]);
    $view_display->save();
    return $view_display;
}

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