You are here

public function FieldPermissionsTestBase::setUp in Field Permissions 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/FieldPermissionsTestBase.php \Drupal\Tests\field_permissions\Functional\FieldPermissionsTestBase::setUp()

Overrides BrowserTestBase::setUp

3 calls to FieldPermissionsTestBase::setUp()
FieldPermissionsCommentTest::setUp in tests/src/Functional/FieldPermissionsCommentTest.php
FieldPermissionsNodeTest::setUp in tests/src/Functional/FieldPermissionsNodeTest.php
FieldPermissionsUserTest::setUp in tests/src/Functional/FieldPermissionsUserTest.php
3 methods override FieldPermissionsTestBase::setUp()
FieldPermissionsCommentTest::setUp in tests/src/Functional/FieldPermissionsCommentTest.php
FieldPermissionsNodeTest::setUp in tests/src/Functional/FieldPermissionsNodeTest.php
FieldPermissionsUserTest::setUp in tests/src/Functional/FieldPermissionsUserTest.php

File

tests/src/Functional/FieldPermissionsTestBase.php, line 95

Class

FieldPermissionsTestBase
A base class for field permissions web tests to extend.

Namespace

Drupal\Tests\field_permissions\Functional

Code

public function setUp() {
  parent::setUp();

  // Create node type.
  $this
    ->drupalCreateContentType([
    'type' => 'article',
    'name' => 'Article',
  ]);
  $this
    ->checkPermissions([
    'create article content',
  ]);
  $this->adminUser = $this
    ->drupalCreateUser([], NULL, TRUE);
  $this->adminUserRole = Role::load($this->adminUser
    ->getRoles(TRUE)[0]);
  $this->limitedUser = $this
    ->drupalCreateUser([
    'access content',
    'access user profiles',
    'create article content',
    'edit any article content',
  ]);
  $this->webUser = $this
    ->drupalCreateUser([
    'access content',
    'create article content',
    'edit any article content',
  ]);
  $this->limitUserRole = Role::load($this->limitedUser
    ->getRoles(TRUE)[0]);
  $this->webUserRole = Role::load($this->webUser
    ->getRoles(TRUE)[0]);
}