You are here

protected function MemberCountBlockTest::assertMemberCount in Organic groups 8

Checks that the block shows the correct member count for the given group.

Parameters

int $group_key: The key of the group for which to check the block.

int $expected_count: The number of members that are expected to be shown in the block.

1 call to MemberCountBlockTest::assertMemberCount()
MemberCountBlockTest::testMemberCountBlock in tests/src/Kernel/Plugin/Block/MemberCountBlockTest.php
Tests the member count block.

File

tests/src/Kernel/Plugin/Block/MemberCountBlockTest.php, line 276

Class

MemberCountBlockTest
Tests the member count block.

Namespace

Drupal\Tests\og\Kernel\Plugin\Block

Code

protected function assertMemberCount($group_key, $expected_count) {
  $expected_string = (string) $this
    ->formatPlural($expected_count, '@label has 1 member.', '@label has @count members', [
    '@label' => $this->groups[$group_key]
      ->label(),
  ]);

  // @todo Use assertStringContainsString() once we are on PHPUnit 9.
  $this
    ->assertTrue(strpos((string) $this
    ->renderBlock($group_key), $expected_string) !== FALSE);
}