You are here

protected function EntityUsageLayoutBuilderTest::setUp in Entity Usage 8.4

Same name in this branch
  1. 8.4 tests/src/Functional/EntityUsageLayoutBuilderTest.php \Drupal\Tests\entity_usage\Functional\EntityUsageLayoutBuilderTest::setUp()
  2. 8.4 tests/src/Kernel/EntityUsageLayoutBuilderTest.php \Drupal\Tests\entity_usage\Kernel\EntityUsageLayoutBuilderTest::setUp()
Same name and namespace in other branches
  1. 8.2 tests/src/Functional/EntityUsageLayoutBuilderTest.php \Drupal\Tests\entity_usage\Functional\EntityUsageLayoutBuilderTest::setUp()

Overrides BrowserTestBase::setUp

File

tests/src/Functional/EntityUsageLayoutBuilderTest.php, line 51

Class

EntityUsageLayoutBuilderTest
Tests layout builder usage through Inline Blocks displays in UI.

Namespace

Drupal\Tests\entity_usage\Functional

Code

protected function setUp() {
  parent::setUp();
  LayoutBuilderEntityViewDisplay::create([
    'targetEntityType' => 'entity_test',
    'bundle' => 'entity_test',
    'mode' => 'default',
    'status' => TRUE,
  ])
    ->enableLayoutBuilder()
    ->setOverridable()
    ->save();
  $this
    ->config('entity_track.settings')
    ->set('track_enabled_entity_types', [
    'entity_test',
    'block_content',
  ])
    ->set('track_enabled_plugins', [
    'layout_builder',
    'entity_reference',
  ])
    ->save();
  $this
    ->config('entity_usage.settings')
    ->set('local_task_enabled_entity_types', [
    'entity_test',
  ])
    ->set('track_enabled_target_entity_types', [
    'entity_test',
    'block_content',
  ])
    ->save();

  /** @var \Drupal\Core\Routing\RouteBuilderInterface $routerBuilder */
  $routerBuilder = \Drupal::service('router.builder');
  $routerBuilder
    ->rebuild();
}