public function GroupCheckTest::testNoGroupFromRouteMatch in Organic groups 8
Tests fetching arguments from the route match with invalid group entity.
File
- tests/
src/ Unit/ GroupCheckTest.php, line 310
Class
- GroupCheckTest
- Tests the group check access.
Namespace
Drupal\Tests\og\UnitCode
public function testNoGroupFromRouteMatch() {
$this->routeMatch
->getRouteObject()
->willReturn($this->route);
$parameter_name = $this
->randomMachineName();
$this->route
->getOption('_og_entity_type_id')
->willReturn($parameter_name);
$this->routeMatch
->getParameter($parameter_name)
->willReturn(NULL);
// Call the group check without the entity related arguments.
$group_check = new GroupCheck($this->entityTypeManager
->reveal(), $this->ogAccess
->reveal());
$result = $group_check
->access($this->user
->reveal(), $this->route
->reveal(), $this->routeMatch
->reveal());
$this
->assertTrue($result
->isForbidden());
}