public function RngEventAccessTest::testAllAccessNoOperationMirror in RNG - Events and Registrations 8
Same name and namespace in other branches
- 8.2 tests/src/Kernel/RngEventAccessTest.php \Drupal\Tests\rng\Kernel\RngEventAccessTest::testAllAccessNoOperationMirror()
- 3.x tests/src/Kernel/RngEventAccessTest.php \Drupal\Tests\rng\Kernel\RngEventAccessTest::testAllAccessNoOperationMirror()
Test user role with access to administer all entities but with no operation mirror.
File
- tests/
src/ Kernel/ RngEventAccessTest.php, line 115
Class
- RngEventAccessTest
- Tests manage event access control. to register for events..
Namespace
Drupal\Tests\rng\KernelCode
public function testAllAccessNoOperationMirror() {
$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',
]);
$this->eventType
->setEventManageOperation(NULL)
->save();
foreach ($this->routes as $route_name) {
$route = $this->routeProvider
->getRouteByName($route_name);
$route_match = new RouteMatch($route_name, $route, $parameters);
// Access is not granted to any route except for the entity edit form.
$access = strpos($route_name, 'edit_form') !== FALSE;
$this
->assertEquals($access, $this->accessManager
->check($route_match, $account), sprintf('All access to with no operation mirror: %s (%s)', $route_name, (string) $access));
}
}