You are here

public function RngEventAccessTest::testAllAccess in RNG - Events and Registrations 8.2

Same name and namespace in other branches
  1. 8 tests/src/Kernel/RngEventAccessTest.php \Drupal\Tests\rng\Kernel\RngEventAccessTest::testAllAccess()
  2. 3.x tests/src/Kernel/RngEventAccessTest.php \Drupal\Tests\rng\Kernel\RngEventAccessTest::testAllAccess()

Test user role with access to administer all entities.

File

tests/src/Kernel/RngEventAccessTest.php, line 96

Class

RngEventAccessTest
Tests manage event access control. to register for events..

Namespace

Drupal\Tests\rng\Kernel

Code

public function testAllAccess() {
  $event = EntityTest::create();
  $event
    ->save();
  $parameters['entity_test'] = $event;

  // 'administer entity_test content' grants update to entitytest entities.
  $account = $this
    ->drupalCreateUser([
    'administer entity_test content',
  ]);
  foreach ($this->routes as $route_name) {
    $route = $this->routeProvider
      ->getRouteByName($route_name);
    $route_match = new RouteMatch($route_name, $route, $parameters);
    $this
      ->assertTrue($this->accessManager
      ->check($route_match, $account), 'All access to: ' . $route_name);
  }
}