You are here

protected function OgGroupContextCacheContextTest::setupExpectedContext in Organic groups 8

Set up expectations for tests that have an active context object.

Parameters

mixed $context: The test data for the active context, as provided by contextProvider().

Overrides OgContextCacheContextTestBase::setupExpectedContext

See also

::contextProvider()

File

tests/src/Unit/Cache/Context/OgGroupContextCacheContextTest.php, line 32

Class

OgGroupContextCacheContextTest
Tests the OG group context cache context.

Namespace

Drupal\Tests\og\Unit\Cache\Context

Code

protected function setupExpectedContext($context) {
  if ($context) {
    $this->group
      ->getEntityTypeId()
      ->willReturn($context['entity_type'])
      ->shouldBeCalled();
    $this->group
      ->id()
      ->willReturn($context['id'])
      ->shouldBeCalled();
    $this
      ->expectGroupContext($this->group
      ->reveal());
  }
  else {
    $this
      ->expectGroupContext();
  }
}