You are here

protected function GTMTestBase::createData in GoogleTagManager 8

Create test data: configuration variables and users.

2 calls to GTMTestBase::createData()
GTMMultipleTest::createData in tests/src/Functional/GTMMultipleTest.php
Create test data: configuration variables and users.
GTMTestBase::testModule in tests/src/Functional/GTMTestBase.php
Test the module.
1 method overrides GTMTestBase::createData()
GTMMultipleTest::createData in tests/src/Functional/GTMMultipleTest.php
Create test data: configuration variables and users.

File

tests/src/Functional/GTMTestBase.php, line 124

Class

GTMTestBase
Tests the Google Tag Manager.

Namespace

Drupal\Tests\google_tag\Functional

Code

protected function createData() {

  // Create an admin user.
  $this
    ->drupalCreateRole([
    'access content',
    'administer google tag manager',
  ], 'admin user');
  $this->adminUser = $this
    ->drupalCreateUser();
  $this->adminUser->roles[] = 'admin user';
  $this->adminUser
    ->save();

  // Create a test user.
  $this
    ->drupalCreateRole([
    'access content',
  ], 'content viewer');
  $this->nonAdminUser = $this
    ->drupalCreateUser();
  $this->nonAdminUser->roles[] = 'content viewer';
  $this->nonAdminUser
    ->save();
}