public function OgMembershipTest::testSetNoUserException in Organic groups 8
Tests exceptions are thrown when trying to save a membership with no user.
@covers ::preSave
File
- tests/
src/ Kernel/ Entity/ OgMembershipTest.php, line 232
Class
- OgMembershipTest
- Tests the OgMembership entity.
Namespace
Drupal\Tests\og\Kernel\EntityCode
public function testSetNoUserException() {
/** @var \Drupal\og\OgMembershipInterface $membership */
$membership = OgMembership::create([
'type' => OgMembershipInterface::TYPE_DEFAULT,
]);
$this
->expectException(EntityStorageException::class);
$membership
->setGroup($this->group)
->save();
}