protected function MemberCountBlockTest::renderBlock in Organic groups 8
Renders the block using the passed in group as the currently active group.
Parameters
int $group_key: The key of the group to set as active group.
Return value
string The content of the block rendered as HTML.
2 calls to MemberCountBlockTest::renderBlock()
- MemberCountBlockTest::assertMemberCount in tests/
src/ Kernel/ Plugin/ Block/ MemberCountBlockTest.php - Checks that the block shows the correct member count for the given group.
- MemberCountBlockTest::testMemberCountBlock in tests/
src/ Kernel/ Plugin/ Block/ MemberCountBlockTest.php - Tests the member count block.
File
- tests/
src/ Kernel/ Plugin/ Block/ MemberCountBlockTest.php, line 249
Class
- MemberCountBlockTest
- Tests the member count block.
Namespace
Drupal\Tests\og\Kernel\Plugin\BlockCode
protected function renderBlock($group_key) {
// Clear the static caches of the cache tags invalidators. The invalidators
// will only invalidate cache tags once per request to improve performance.
// Unfortunately they can not distinguish between an actual Drupal page
// request and a PHPUnit test that simulates visiting multiple pages.
// We are pretending that every time this method is called a new page has
// been requested, and the static caches are empty.
$this->cacheTagsInvalidator
->resetChecksums();
$this->activeGroup = $this->groups[$group_key];
$render_array = $this->blockViewBuilder
->view($this->block);
$html = $this->renderer
->renderRoot($render_array);
// At all times, after a block is rendered, it should be cached.
$this
->assertCached($group_key);
return $html;
}