You are here

protected function IsGroupMemberCacheContextTest::createEntityTypeManager in Group 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/IsGroupMemberCacheContextTest.php \Drupal\Tests\group\Unit\IsGroupMemberCacheContextTest::createEntityTypeManager()

Creates an EntityTypeManagerInterface prophecy.

Parameters

int $group_id: The group ID that the group storage will be able to load.

Return value

\Prophecy\Prophecy\ObjectProphecy The prophesized entity type manager.

File

tests/src/Unit/IsGroupMemberCacheContextTest.php, line 160

Class

IsGroupMemberCacheContextTest
Tests the user.is_group_member:%group_id cache context.

Namespace

Drupal\Tests\group\Unit

Code

protected function createEntityTypeManager($group_id) {
  $prophecy = $this
    ->prophesize(EntityTypeManagerInterface::class);
  $storage = $this
    ->prophesize(ContentEntityStorageInterface::class);
  $storage
    ->load(Argument::any())
    ->willReturn(NULL);
  $storage
    ->load($group_id)
    ->willReturn($this->group);
  $prophecy
    ->getStorage('group')
    ->willReturn($storage
    ->reveal());
  return $prophecy;
}