public function BambooTwigSecurityTest::testHasPermission in Bamboo Twig 8
Same name and namespace in other branches
- 8.5 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::testHasPermission()
- 8.2 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::testHasPermission()
- 8.3 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::testHasPermission()
- 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 59
Class
- BambooTwigSecurityTest
- Tests Security twig filters and functions.
Namespace
Drupal\Tests\bamboo_twig\FunctionalCode
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');
}