You are here

public function BambooTwigSecurityTest::testHasPermission in Bamboo Twig 8.3

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

@covers Drupal\bamboo_twig_security\TwigExtension\Security::hasPermission

File

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

Class

BambooTwigSecurityTest
Tests Security twig filters and functions.

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

public function testHasPermission() {
  $this
    ->drupalGet('/bamboo-twig-security');
  $this
    ->assertElementPresent('.test-security div.security-permission-current');
  $this
    ->assertElementContains('.test-security div.security-permission-current', 'FALSE');
  $this
    ->assertElementPresent('.test-security div.security-permission-admin');
  $this
    ->assertElementContains('.test-security div.security-permission-admin', 'TRUE');
  $this
    ->assertElementPresent('.test-security div.security-permission-nobody');
  $this
    ->assertElementContains('.test-security div.security-permission-nobody', 'FALSE');
  $this
    ->drupalLogin($this->admin_user);
  $this
    ->drupalGet('/bamboo-twig-security');
  $this
    ->assertElementPresent('.test-security div.security-permission-current');
  $this
    ->assertElementContains('.test-security div.security-permission-current', 'TRUE');
  $this
    ->assertElementPresent('.test-security div.security-permission-admin');
  $this
    ->assertElementContains('.test-security div.security-permission-admin', 'TRUE');
  $this
    ->assertElementPresent('.test-security div.security-permission-nobody');
  $this
    ->assertElementContains('.test-security div.security-permission-nobody', 'FALSE');
}