You are here

public function RabbitHoleBehaviorInvocationTestBase::testRabbitHoleBypassPermissions in Rabbit Hole 2.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/RabbitHoleBehaviorInvocationTestBase.php \Drupal\Tests\rabbit_hole\Functional\RabbitHoleBehaviorInvocationTestBase::testRabbitHoleBypassPermissions()

Test "rabbit hole bypass *" permissions.

File

tests/src/Functional/RabbitHoleBehaviorInvocationTestBase.php, line 114

Class

RabbitHoleBehaviorInvocationTestBase
Base class for the rabbit hole behaviors invocation tests.

Namespace

Drupal\Tests\rabbit_hole\Functional

Code

public function testRabbitHoleBypassPermissions() {
  $this
    ->drupalLogin($this
    ->createUser(array_merge($this
    ->getViewPermissions(), [
    'rabbit hole bypass ' . $this->entityType,
  ])));
  $this
    ->createEntityBundle();
  $entity = $this
    ->createEntity('page_not_found');
  $this
    ->drupalGet($entity
    ->toUrl()
    ->toString());

  // Users with bypass permission should have access to entity pages.
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}