public function SubscriptionControllerTest::testGroupManager in Organic groups 8
Tests group manager trying to unsubscribe from group.
@covers ::unsubscribe @dataProvider memberProvider
File
- tests/
src/ Unit/ SubscriptionControllerTest.php, line 225
Class
- SubscriptionControllerTest
- Tests the subscription controller.
Namespace
Drupal\Tests\og\UnitCode
public function testGroupManager($state) {
$states = [
OgMembershipInterface::STATE_ACTIVE,
OgMembershipInterface::STATE_PENDING,
OgMembershipInterface::STATE_BLOCKED,
];
$this->group
->willImplement(EntityOwnerInterface::class);
$this->membershipManager
->getMembership($this->group
->reveal(), $this->userId, $states)
->willReturn($this->ogMembership
->reveal());
$this->ogMembership
->getState()
->willReturn($state);
$this->group
->getOwnerId()
->willReturn($this->userId);
$this->group
->label()
->shouldBeCalled();
$this->group
->toUrl()
->willReturn($this->url
->reveal());
$this->url
->setAbsolute()
->willReturn($this->url
->reveal());
$this->url
->toString()
->willReturn($this
->randomMachineName());
$this->entityFormBuilder
->getForm($this->ogMembership
->reveal(), 'unsubscribe')
->shouldNotBeCalled();
$this
->unsubscribe();
}