You are here

public function OgMembershipTest::testSetNoGroupException in Organic groups 8

Tests exceptions are thrown when trying to save a membership with no group.

@covers ::preSave

File

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

Class

OgMembershipTest
Tests the OgMembership entity.

Namespace

Drupal\Tests\og\Kernel\Entity

Code

public function testSetNoGroupException() {

  /** @var \Drupal\og\OgMembershipInterface $membership */
  $membership = OgMembership::create();
  $this
    ->expectException(EntityStorageException::class);
  $membership
    ->setOwner($this->user)
    ->save();
}