You are here

public function GroupSubscribeTest::testUnSubscribeAccess in Organic groups 8

Tests access to un-subscribe page.

File

tests/src/Functional/GroupSubscribeTest.php, line 332

Class

GroupSubscribeTest
Tests subscribe and un-subscribe to groups.

Namespace

Drupal\Tests\og\Functional

Code

public function testUnSubscribeAccess() {
  $this
    ->createOgMembership($this->group1, $this->normalUser);
  $this
    ->drupalLogin($this->normalUser);
  $scenarios = [
    $this->group1
      ->id() => 200,
    $this->group2
      ->id() => 403,
  ];
  foreach ($scenarios as $entity_id => $code) {
    $path = "group/node/{$entity_id}/unsubscribe";
    $this
      ->drupalGet($path);
    $this
      ->assertSession()
      ->statusCodeEquals($code);
  }
}