function EntityConcurrentRenderTest::setUp

Same name and namespace in other branches
  1. main core/tests/Drupal/FunctionalTests/Entity/EntityConcurrentRenderTest.php \Drupal\FunctionalTests\Entity\EntityConcurrentRenderTest::setUp()

Overrides BrowserTestBase::setUp

File

core/tests/Drupal/FunctionalTests/Entity/EntityConcurrentRenderTest.php, line 40

Class

EntityConcurrentRenderTest
Tests that the same entity can be rendered multiple times on a page.

Namespace

Drupal\FunctionalTests\Entity

Code

protected function setUp() : void {
  parent::setUp();
  // Add a formatted text field. The text format processing creates filter
  // placeholders during rendering, which causes the block's Fiber to
  // suspend and allows other block Fibers to interleave.
  FieldStorageConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => 'body',
    'type' => 'text_long',
  ])->save();
  FieldConfig::create([
    'entity_type' => 'entity_test',
    'bundle' => 'entity_test',
    'field_name' => 'body',
    'label' => 'Body',
  ])->save();
  \Drupal::service('entity_display.repository')->getViewDisplay('entity_test', 'entity_test')
    ->setComponent('body')
    ->save();
  $this->drupalLogin($this->drupalCreateUser([
    'view test entity',
  ]));
}

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