You are here

public function ContentAccessModuleTest::setUp in Content Access 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/ContentAccessModuleTest.php, line 67

Class

ContentAccessModuleTest
Automated BrowserTest Case for content access module.

Namespace

Drupal\Tests\content_access\Functional

Code

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

  // Create test user with separate role.
  $this->testUser = $this
    ->drupalCreateUser();

  // Create admin user.
  $this->adminUser = $this
    ->drupalCreateUser([
    'access content',
    'administer content types',
    'grant content access',
    'grant own content access',
    'bypass node access',
    'access administration pages',
  ]);
  $this
    ->drupalLogin($this->adminUser);

  // Rebuild content access permissions.
  node_access_rebuild();

  // Create test content type.
  $this->contentType = $this
    ->drupalCreateContentType();

  // Create test nodes.
  $this->node1 = $this
    ->drupalCreateNode([
    'type' => $this->contentType
      ->id(),
  ]);
  $this->node2 = $this
    ->drupalCreateNode([
    'type' => $this->contentType
      ->id(),
  ]);
}