You are here

protected function LinkAreaTest::setUp in Views link area 8

Parameters

bool $import_test_views: Should the views specified on the test class be imported. If you need to setup some additional stuff, like fields, you need to call false and then call createTestViews for your own.

Overrides ViewsKernelTestBase::setUp

File

tests/src/Kernel/Plugin/LinkTest.php, line 37

Class

LinkAreaTest
Tests the page display plugin.

Namespace

Drupal\Tests\views_linkarea\Kernel\Plugin

Code

protected function setUp($import_test_views = TRUE) {
  parent::setUp();
  if ($import_test_views) {
    ViewTestData::createTestViews(get_class($this), [
      'views_test_linkarea',
    ]);
  }
  $random_label = $this
    ->randomMachineName();
  $data = [
    'bundle' => 'entity_test',
    'name' => $random_label,
  ];
  $entity_test = $this->container
    ->get('entity.manager')
    ->getStorage('entity_test')
    ->create($data);
  $entity_test
    ->save();
  $this->entityId = $entity_test
    ->id();
  \Drupal::state()
    ->set('entity_test_entity_access.view.' . $entity_test
    ->id(), TRUE);
}