public function OgMembershipTest::testGetGroup in Organic groups 8
Tests getting the group that is associated with a membership.
@covers ::getGroup
File
- tests/
src/ Kernel/ Entity/ OgMembershipTest.php, line 636
Class
- OgMembershipTest
- Tests the OgMembership entity.
Namespace
Drupal\Tests\og\Kernel\EntityCode
public function testGetGroup() {
$membership = OgMembership::create();
// Set a group.
$membership
->setGroup($this->group);
// Now the group should be returned. Check both the entity type and ID.
$this
->assertEquals($this->group
->getEntityTypeId(), $membership
->getGroup()
->getEntityTypeId());
$this
->assertEquals($this->group
->id(), $membership
->getGroup()
->id());
}