You are here

function OgSubscribe::setUp in Organic groups 6.2

Same name and namespace in other branches
  1. 6 tests/og.subscribe.test \OgSubscribe::setUp()

Implementation of setUp().

Overrides DrupalWebTestCase::setUp

File

tests/og.subscribe.test, line 22

Class

OgSubscribe

Code

function setUp() {
  parent::setUp('og', 'og_access');

  // Create a user with admin permissions.
  $this->web_admin = $this
    ->drupalCreateUser(array(
    'administer nodes',
    'administer content types',
    'access administration pages',
    'administer site configuration',
    'administer organic groups',
  ));
  $this
    ->drupalLogin($this->web_admin);

  // Create a group node content type.
  $og_group_type = $this
    ->drupalCreateContentType();
  variable_set('og_content_type_usage_' . $og_group_type->name, 'group');

  // Rebuild the menu so the new content types will appear in the menu.
  menu_rebuild();

  // Create groups with different visibility (open, moderated, etc').
  $this->selective = array(
    'open' => OG_OPEN,
    'moderated' => OG_MODERATED,
    'invite' => OG_INVITE_ONLY,
    'closed' => OG_CLOSED,
  );
  $this->selective_labels = array_flip($this->selective);
  $this->nodes = array();
  foreach ($this->selective as $key => $selective) {

    // Create a group node and save the node in $this.
    $this->nodes[$key] = node_load($this
      ->addOgGroup($og_group_type->name, $selective));
  }

  // Create web user that will join the groups.
  $this->web_user = $this
    ->drupalCreateUser(array(
    'access content',
  ));
}