You are here

public function GroupSubscribeFormatterTest::testFormatter in Organic groups 8

Tests the formatter changes by user and membership.

File

tests/src/Functional/GroupSubscribeFormatterTest.php, line 102

Class

GroupSubscribeFormatterTest
Tests subscribe and un-subscribe formatter.

Namespace

Drupal\Tests\og\Functional

Code

public function testFormatter() {
  $this
    ->drupalLogin($this->user1);

  // Subscribe to group.
  $this
    ->drupalGet('node/' . $this->group
    ->id());
  $this
    ->clickLink('Subscribe to group');
  $this
    ->click('#edit-submit');
  $this
    ->drupalGet('node/' . $this->group
    ->id());
  $this
    ->assertSession()
    ->linkExists('Unsubscribe from group');

  // Validate another user sees the correct formatter link.
  $this
    ->drupalLogin($this->user2);
  $this
    ->drupalGet('node/' . $this->group
    ->id());
  $this
    ->clickLink('Subscribe to group');
}