You are here

public function GroupSubscribeFormatterTest::testSubscribeWithoutApprovalPermission in Organic groups 8

Tests the formatter for subscribe without approval.

File

tests/src/Unit/GroupSubscribeFormatterTest.php, line 261

Class

GroupSubscribeFormatterTest
Tests the OG group formatter.

Namespace

Drupal\Tests\og\Unit

Code

public function testSubscribeWithoutApprovalPermission() {
  $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(TRUE);
  $elements = $this
    ->getElements();
  $this
    ->assertEquals('Subscribe to group', $elements[0]['#title']);
}