public function BambooTwigSecurityTest::testHasRoles in Bamboo Twig 8.5
Same name in this branch
- 8.5 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::testHasRoles()
- 8.5 tests/src/Kernel/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Kernel\BambooTwigSecurityTest::testHasRoles()
Same name and namespace in other branches
- 8.4 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::testHasRoles()
@covers Drupal\bamboo_twig_security\TwigExtension\Security::hasRoles
File
- tests/
src/ Functional/ BambooTwigSecurityTest.php, line 156
Class
- BambooTwigSecurityTest
- Tests Security twig filters and functions.
Namespace
Drupal\Tests\bamboo_twig\FunctionalCode
public function testHasRoles() {
$this
->drupalGet('/bamboo-twig-security');
$this
->assertSession()
->elementExists('css', '.test-security div.security-roles-current');
$this
->assertElementContains('.test-security div.security-roles-current', 'FALSE');
$this
->assertSession()
->elementExists('css', '.test-security div.security-roles-admin');
$this
->assertElementContains('.test-security div.security-roles-admin', 'TRUE');
$this
->assertSession()
->elementExists('css', '.test-security div.security-roles-user-none-or');
$this
->assertElementContains('.test-security div.security-roles-user-none-or', 'FALSE');
$this
->assertSession()
->elementExists('css', '.test-security div.security-roles-user-none-and');
$this
->assertElementContains('.test-security div.security-roles-user-none-and', 'FALSE');
$this
->assertSession()
->elementExists('css', '.test-security div.security-roles-nobody-or');
$this
->assertElementContains('.test-security div.security-roles-nobody-or', 'FALSE');
$this
->assertSession()
->elementExists('css', '.test-security div.security-roles-nobody-and');
$this
->assertElementContains('.test-security div.security-roles-nobody-and', 'FALSE');
$this
->drupalLogin($this->admin_user);
$this
->drupalGet('/bamboo-twig-security');
$this
->assertSession()
->elementExists('css', '.test-security div.security-roles-current');
$this
->assertElementContains('.test-security div.security-roles-current', 'TRUE');
$this
->assertSession()
->elementExists('css', '.test-security div.security-roles-admin');
$this
->assertElementContains('.test-security div.security-roles-admin', 'TRUE');
$this
->assertSession()
->elementExists('css', '.test-security div.security-roles-admin-or');
$this
->assertElementContains('.test-security div.security-roles-admin-or', 'TRUE');
$this
->assertSession()
->elementExists('css', '.test-security div.security-roles-user-none-or');
$this
->assertElementContains('.test-security div.security-roles-user-none-or', 'FALSE');
$this
->assertSession()
->elementExists('css', '.test-security div.security-roles-user-none-and');
$this
->assertElementContains('.test-security div.security-roles-user-none-and', 'FALSE');
$this
->assertSession()
->elementExists('css', '.test-security div.security-roles-nobody-or');
$this
->assertElementContains('.test-security div.security-roles-nobody-or', 'FALSE');
$this
->assertSession()
->elementExists('css', '.test-security div.security-roles-nobody-and');
$this
->assertElementContains('.test-security div.security-roles-nobody-and', 'FALSE');
}