You are here

protected function OgRouteGroupResolverTestBase::mightRetrieveRouteObject in Organic groups 8

Adds an expectation that the plugin will (not) retrieve the route object.

If the current path is an entity path, the plugin should retrieve the entity from the route so it can check if the entity is a group. If we are not, then it should not attempt to retrieve it.

Parameters

string|null $route_object_id: The ID of the entity that is present on the current route, or NULL if we are not on a content entity path. The ID may be any of the ones created in the test setup, e.g. 'group', 'group_content', 'non_group'.

1 call to OgRouteGroupResolverTestBase::mightRetrieveRouteObject()
OgRouteGroupResolverTestBase::testResolve in tests/src/Unit/Plugin/OgGroupResolver/OgRouteGroupResolverTestBase.php
@todo Update documentation.

File

tests/src/Unit/Plugin/OgGroupResolver/OgRouteGroupResolverTestBase.php, line 213

Class

OgRouteGroupResolverTestBase
Base class for testing OgGroupResolver plugins that depend on the route.

Namespace

Drupal\Tests\og\Unit\Plugin\OgGroupResolver

Code

protected function mightRetrieveRouteObject($route_object_id) {

  // The route object should only be retrieved if we are on a content entity
  // path.
  if ($route_object_id) {
    $this->routeMatch
      ->getParameter($this
      ->getTestEntityProperties()[$route_object_id]['type'])
      ->willReturn($this->testEntities[$route_object_id]);
  }
}