public function GroupSubscribeFormatterTest::testSubscribeWithApprovalPermission in Organic groups 8
Tests the formatter for subscribe with approval.
File
- tests/
src/ Unit/ GroupSubscribeFormatterTest.php, line 274
Class
- GroupSubscribeFormatterTest
- Tests the OG group formatter.
Namespace
Drupal\Tests\og\UnitCode
public function testSubscribeWithApprovalPermission() {
$this->group
->getOwnerId()
->willReturn(rand(100, 200));
$this->ogAccess
->userAccess($this->group
->reveal(), 'subscribe without approval', $this->user
->reveal())
->willReturn($this->accessResult
->reveal());
$this->accessResult
->isAllowed()
->willReturn(FALSE);
/** @var \Drupal\Core\Access\AccessResult $access_result */
$access_result = $this
->prophesize(AccessResultInterface::class);
$this->ogAccess
->userAccess($this->group
->reveal(), 'subscribe', $this->user
->reveal())
->willReturn($access_result
->reveal());
$access_result
->isAllowed()
->willReturn(TRUE);
$elements = $this
->getElements();
$this
->assertEquals('Request group membership', $elements[0]['#title']);
}