You are here

public function GroupCheckTest::testNoArgumentsFromRouteMatch in Organic groups 8

Tests fetching arguments from the route match without "getOption" defined.

File

tests/src/Unit/GroupCheckTest.php, line 290

Class

GroupCheckTest
Tests the group check access.

Namespace

Drupal\Tests\og\Unit

Code

public function testNoArgumentsFromRouteMatch() {
  $this->routeMatch
    ->getRouteObject()
    ->willReturn($this->route);
  $this->route
    ->getOption('_og_entity_type_id')
    ->willReturn(NULL);

  // Call the group check without the entity related arguments.
  $group_check = new GroupCheck($this->entityTypeManager
    ->reveal(), $this->ogAccess
    ->reveal());
  $this
    ->expectException(\BadMethodCallException::class);
  $group_check
    ->access($this->user
    ->reveal(), $this->route
    ->reveal(), $this->routeMatch
    ->reveal());
}