You are here

public function RngEventAccessTest::testAnonymous in RNG - Events and Registrations 3.x

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

Test anonymous user.

File

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

Class

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

Namespace

Drupal\Tests\rng\Kernel

Code

public function testAnonymous() {
  $event = EntityTest::create();
  $event
    ->save();
  $parameters['entity_test'] = $event;
  $account = new AnonymousUserSession();
  foreach ($this->routes as $route_name) {
    $route = $this->routeProvider
      ->getRouteByName($route_name);
    $route_match = new RouteMatch($route_name, $route, $parameters);
    $this
      ->assertFalse($this->accessManager
      ->check($route_match, $account), 'No anonymous access to: ' . $route_name);
  }
}