You are here

protected function BaseFieldAccessTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php \Drupal\Tests\views\Functional\Entity\BaseFieldAccessTest::setUp()

Overrides ViewTestBase::setUp

File

core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php, line 40

Class

BaseFieldAccessTest
Tests views base field access.

Namespace

Drupal\Tests\views\Functional\Entity

Code

protected function setUp($import_test_views = TRUE) {
  parent::setUp($import_test_views);
  ViewTestData::createTestViews(get_class($this), [
    'comment_test_views',
  ]);
  \Drupal::state()
    ->set('entity_test.views_data', [
    'entity_test' => [
      'test_text_access' => [
        'field' => [
          'id' => 'standard',
        ],
      ],
    ],
  ]);
  $entity_1 = EntityTest::create([
    'test_text_access' => 'no access value',
  ]);
  $entity_1
    ->save();
  $entity_2 = EntityTest::create([
    'test_text_access' => 'ok to see this one',
  ]);
  $entity_2
    ->save();
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'access content',
  ]));
}