You are here

public function BambooTwigSecurityTest::setUp in Bamboo Twig 8.4

Same name in this branch
  1. 8.4 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::setUp()
  2. 8.4 tests/src/Kernel/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Kernel\BambooTwigSecurityTest::setUp()
Same name and namespace in other branches
  1. 8.5 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::setUp()
  2. 8 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::setUp()
  3. 8.2 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::setUp()
  4. 8.3 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::setUp()

Overrides BambooTwigTestBase::setUp

File

tests/src/Functional/BambooTwigSecurityTest.php, line 26

Class

BambooTwigSecurityTest
Tests Security twig filters and functions.

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

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

  /** @var \Drupal\Core\Entity\EntityTypeManager $entityTypeManager */
  $this->entityTypeManager = $this->container
    ->get('entity_type.manager');
  $this->admin_user = $this
    ->drupalCreateUser([
    'access content',
    'administer content types',
    'bypass node access',
    'administer site configuration',
    'view the administration theme',
    'administer menu',
    'access administration pages',
  ]);
  $this->admin_user
    ->addRole('administrator');
  $this->admin_user
    ->save();

  // Add the administrator roles to the default user 1.
  $admin = $this->entityTypeManager
    ->getStorage('user')
    ->load(1);
  $admin
    ->addRole('administrator');
  $admin
    ->save();
}