You are here

public function SubscriptionControllerTest::testNotMember in Organic groups 8

Tests non-member trying to unsubscribe from group.

@covers ::unsubscribe

File

tests/src/Unit/SubscriptionControllerTest.php, line 133

Class

SubscriptionControllerTest
Tests the subscription controller.

Namespace

Drupal\Tests\og\Unit

Code

public function testNotMember() {
  $states = [
    OgMembershipInterface::STATE_ACTIVE,
    OgMembershipInterface::STATE_PENDING,
    OgMembershipInterface::STATE_BLOCKED,
  ];
  $this->membershipManager
    ->getMembership($this->group
    ->reveal(), $this->userId, $states)
    ->willReturn(NULL);
  $this
    ->expectException(AccessDeniedHttpException::class);
  $this
    ->unsubscribe();
}