You are here

public function OgMembershipTest::testGetSetState in Organic groups 8

Tests boolean check for states.

@covers ::isActive @covers ::isPending @covers ::isBlocked @dataProvider statesProvider

File

tests/src/Kernel/Entity/OgMembershipTest.php, line 621

Class

OgMembershipTest
Tests the OgMembership entity.

Namespace

Drupal\Tests\og\Kernel\Entity

Code

public function testGetSetState($state, $method) {
  $membership = Og::createMembership($this->group, $this->user);
  $membership
    ->setState($state)
    ->save();
  $membership = $this->entityTypeManager
    ->getStorage('og_membership')
    ->loadUnchanged($membership
    ->id());
  $this
    ->assertEquals($state, $membership
    ->getState());
  $this
    ->assertTrue($membership
    ->{$method}());
}