You are here

protected function OgSubscribe::_testWebUserSubscribe in Organic groups 6.2

Test current user subscription to a group.

1 call to OgSubscribe::_testWebUserSubscribe()
OgSubscribe::testWebUserSubscribeOg in tests/og.subscribe.test
Test a web user subscribing and unsubscribing a group.

File

tests/og.subscribe.test, line 84

Class

OgSubscribe

Code

protected function _testWebUserSubscribe($selective, $text) {
  $node = $this->nodes[$selective];

  // Get the subscription page.
  $this
    ->drupalGet('og/subscribe/' . $node->nid);
  $this
    ->assertRaw(t('Are you sure you want to join the group %title?', array(
    '%title' => $node->title,
  )), t('Confirmation of subscribe to @selective group text found.', array(
    '@selective' => $selective,
  )));

  // Click the join button.
  $this
    ->drupalPost(NULL, array(), $text['join_button']);

  // Assert membership request response text.
  $this
    ->assertRaw($text['request_response'], t('Subscribed to @selective group text found.', array(
    '@selective' => $selective,
  )));
  if ($selective == 'open') {
    $this
      ->assertOgMember($this->web_user, $node);
  }
  else {
    $this
      ->assertNotOgMember($this->web_user, $node);
    $this
      ->assertOgPendingMember($this->web_user, $node);
  }
}