You are here

function OgContext::setUp in Organic groups 6.2

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

Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix. A temporary files directory is created with the same name as the database prefix.

Parameters

...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.

Overrides DrupalWebTestCase::setUp

File

tests/og.context.test, line 19

Class

OgContext

Code

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

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

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

  // Create a second group node content type, so user is a member of
  // two groups.
  $og_group_type_second = $this
    ->drupalCreateContentType();
  variable_set('og_content_type_usage_' . $og_group_type_second->name, 'group');

  // Create a group post content type.
  $og_post_type = $this
    ->drupalCreateContentType();
  variable_set('og_content_type_usage_' . $og_post_type->name, 'group_post_standard');
  $this->post_type = $og_post_type->name;

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

  // Create a group node.
  $this->group_nid = $this
    ->addOgGroup($og_group_type->name);

  // Create the second group node.
  $this->group_nid_second = $this
    ->addOgGroup($og_group_type_second->name);

  // Create a post node.
  $this->post_nid = $this
    ->addOgPost($og_post_type->name, array(
    $this->group_nid,
  ));

  // Add the 'Group details' block (it's delta is 0).
  $edit = array();
  $edit['og_0[region]'] = 'left';
  $this
    ->drupalPost('admin/build/block', $edit, t('Save blocks'));
  $this
    ->assertText(t('The block settings have been updated.'), t('Block successfully added.'));
}