public function SubscriptionControllerTest::testBlockedMember in Organic groups 8
Tests blocked member trying to unsubscribe from group.
@covers ::unsubscribe
File
- tests/
src/ Unit/ SubscriptionControllerTest.php, line 154
Class
- SubscriptionControllerTest
- Tests the subscription controller.
Namespace
Drupal\Tests\og\UnitCode
public function testBlockedMember() {
$states = [
OgMembershipInterface::STATE_ACTIVE,
OgMembershipInterface::STATE_PENDING,
OgMembershipInterface::STATE_BLOCKED,
];
$this->membershipManager
->getMembership($this->group
->reveal(), $this->userId, $states)
->willReturn($this->ogMembership
->reveal());
$this->ogMembership
->getState()
->willReturn(OgMembershipInterface::STATE_BLOCKED);
$this
->expectException(AccessDeniedHttpException::class);
$this
->unsubscribe();
}