protected function OgMembershipTest::assertOwner in Organic groups 8
Asserts that the test user is set as the owner of the given membership.
Parameters
\Drupal\og\OgMembershipInterface $membership: The membership to check.
2 calls to OgMembershipTest::assertOwner()
- OgMembershipTest::testGetSetOwner in tests/
src/ Kernel/ Entity/ OgMembershipTest.php - Tests getting and setting owners on OgMemberships.
- OgMembershipTest::testGetSetOwnerId in tests/
src/ Kernel/ Entity/ OgMembershipTest.php - Tests getting and setting owners by ID on OgMemberships.
File
- tests/
src/ Kernel/ Entity/ OgMembershipTest.php, line 189
Class
- OgMembershipTest
- Tests the OgMembership entity.
Namespace
Drupal\Tests\og\Kernel\EntityCode
protected function assertOwner(OgMembershipInterface $membership) {
// Check the user is returned.
$this
->assertInstanceOf(UserInterface::class, $membership
->getOwner());
$this
->assertEquals($this->user
->id(), $membership
->getOwnerId());
// And after re-loading.
/** @var \Drupal\og\OgMembershipInterface $membership */
$membership = $this->entityTypeManager
->getStorage('og_membership')
->loadUnchanged($membership
->id());
$this
->assertInstanceOf(UserInterface::class, $membership
->getOwner());
$this
->assertEquals($this->user
->id(), $membership
->getOwnerId());
}