You are here

protected function OgContextCacheContextTestBase::expectGroupContext in Organic groups 8

Sets an expectation that OgContext will return the given group.

Parameters

\Drupal\Core\Entity\EntityInterface|null $group: The group to return, or NULL if no group is expected to be returned by OgContext.

4 calls to OgContextCacheContextTestBase::expectGroupContext()
OgGroupContextCacheContextTest::setupExpectedContext in tests/src/Unit/Cache/Context/OgGroupContextCacheContextTest.php
Set up expectations for tests that have an active context object.
OgGroupContextCacheContextTest::testWithoutContext in tests/src/Unit/Cache/Context/OgGroupContextCacheContextTest.php
Tests getting cache context when there is no matching group on the route.
OgMembershipStateCacheContextTest::setupExpectedContext in tests/src/Unit/Cache/Context/OgMembershipStateCacheContextTest.php
Set up expectations for tests that have an active context object.
OgMembershipStateCacheContextTest::testWithoutContext in tests/src/Unit/Cache/Context/OgMembershipStateCacheContextTest.php
Tests the result of the cache context service without active context.

File

tests/src/Unit/Cache/Context/OgContextCacheContextTestBase.php, line 105

Class

OgContextCacheContextTestBase
Base class for testing cache contexts that rely on OgContext.

Namespace

Drupal\Tests\og\Unit\Cache\Context

Code

protected function expectGroupContext(?EntityInterface $group = NULL) {
  $this->ogContext
    ->getGroup()
    ->willReturn($group);
}