public function BambooTwigSecurityTest::testHasRole in Bamboo Twig 8
Same name and namespace in other branches
- 8.5 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::testHasRole()
- 8.2 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::testHasRole()
- 8.3 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::testHasRole()
- 8.4 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::testHasRole()
@covers Drupal\bamboo_twig_security\TwigExtension\Security::hasRole
File
- tests/
src/ Functional/ BambooTwigSecurityTest.php, line 87
Class
- BambooTwigSecurityTest
- Tests Security twig filters and functions.
Namespace
Drupal\Tests\bamboo_twig\FunctionalCode
public function testHasRole() {
$this
->drupalGet('/bamboo-twig-security');
$this
->assertElementPresent('.test-security div.security-role-current');
$this
->assertElementContains('.test-security div.security-role-current', 'FALSE');
$this
->assertElementPresent('.test-security div.security-role-admin');
$this
->assertElementContains('.test-security div.security-role-admin', 'TRUE');
$this
->assertElementPresent('.test-security div.security-role-nobody');
$this
->assertElementContains('.test-security div.security-role-nobody', 'FALSE');
$this
->drupalLogin($this->admin_user);
$this
->drupalGet('/bamboo-twig-security');
$this
->assertElementPresent('.test-security div.security-role-current');
$this
->assertElementContains('.test-security div.security-role-current', 'TRUE');
$this
->assertElementPresent('.test-security div.security-role-admin');
$this
->assertElementContains('.test-security div.security-role-admin', 'TRUE');
$this
->assertElementPresent('.test-security div.security-role-nobody');
$this
->assertElementContains('.test-security div.security-role-nobody', 'FALSE');
}