You are here

public function SubscriptionControllerTest::testMember in Organic groups 8

Tests active and pending members trying to unsubscribe from group.

@covers ::unsubscribe @dataProvider memberProvider

File

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

Class

SubscriptionControllerTest
Tests the subscription controller.

Namespace

Drupal\Tests\og\Unit

Code

public function testMember($state) {
  $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($state);
  $this->entityFormBuilder
    ->getForm($this->ogMembership
    ->reveal(), 'unsubscribe')
    ->shouldBeCalled();
  $this
    ->unsubscribe();
}