public function GroupSubscribeFormatterTest::testMember in Organic groups 8
Tests the formatter for an active or pending member.
File
- tests/
src/ Unit/ GroupSubscribeFormatterTest.php, line 334
Class
- GroupSubscribeFormatterTest
- Tests the OG group formatter.
Namespace
Drupal\Tests\og\UnitCode
public function testMember() {
$this->group
->getOwnerId()
->willReturn(rand(100, 200));
$this->membershipManager
->isMember($this->group
->reveal(), $this->user
->reveal()
->id(), [
OgMembershipInterface::STATE_BLOCKED,
])
->willReturn(FALSE);
$this->membershipManager
->isMember($this->group
->reveal(), $this->user
->reveal()
->id(), [
OgMembershipInterface::STATE_ACTIVE,
OgMembershipInterface::STATE_PENDING,
])
->willReturn(TRUE);
$elements = $this
->getElements();
$this
->assertEquals('Unsubscribe from group', $elements[0]['#title']);
}