You are here

public function SpacesOGTestCase::setUp in Spaces 7.3

Same name and namespace in other branches
  1. 6.3 spaces_og/tests/spaces_og.test \SpacesOGTestCase::setUp()
  2. 7 spaces_og/tests/spaces_og.test \SpacesOGTestCase::setUp()

Set up test.

Overrides DrupalWebTestCase::setUp

1 call to SpacesOGTestCase::setUp()
SpacesOGTestAutocomplete::setUp in spaces_og/tests/spaces_og.test
Set up test.
1 method overrides SpacesOGTestCase::setUp()
SpacesOGTestAutocomplete::setUp in spaces_og/tests/spaces_og.test
Set up test.

File

spaces_og/tests/spaces_og.test, line 15

Class

SpacesOGTestCase
Base test class for Spaces OG tests.

Code

public function setUp() {

  // Not enabling views leads to notices if views is present in search path :P
  parent::setUp('context', 'ctools', 'strongarm', 'views', 'features', 'features_test', 'og', 'og_ui', 'og_access', 'og_views', 'og_example', 'purl', 'spaces', 'spaces_ui', 'spaces_og', 'spaces_test', 'taxonomy');

  // Configure Group space with path modifyer.
  variable_set('purl_types', array(
    'path' => 'path',
  ));
  variable_set('purl_method_spaces_og', 'path');

  // Log in admin user.
  $this
    ->loginAdminUser();

  // Rebuild node access table otherwise ACL's won't work.
  $this
    ->drupalPost('admin/reports/status/rebuild', array(), 'Rebuild permissions');

  // Pick a default for group spaces (part of the install process).
  $edit = array(
    'spaces_preset_og' => 'og_public',
  );
  $this
    ->drupalPost('admin/structure/spaces', $edit, 'Save configuration');

  // // Configure organic groups space and set up an organic group.
  // $edit = array(
  //   'name' => 'Group',
  //   'type' => 'group',
  //   'og_group_type' => 'group',
  // );
  // $this->drupalPost('admin/structure/types/add', $edit, 'Save content type');
  // $this->assertText('The content type Group has been added.');
  $this
    ->drupalGet('admin/config/search/purl');

  // $this->drupalGet('node/add/group');
  //
  // $edit = array(
  //   'title' => 'Group A',
  //   'og_description' => 'Group A.',
  //   'purl[value]' => 'group-a',
  //   'type' => 'group',
  // );
  // $this->drupalPost('node/add/group', $edit, 'Save');
  // debug($this->drupalGetNodeByTitle('Group A'));
  $node = array(
    'title' => 'Group A',
    'type' => 'group',
    'purl' => 'group-a',
    'purl' => array(
      'value' => 'group-a',
    ),
    'og_public' => TRUE,
    'og_private' => FALSE,
  );
  $group = $this
    ->drupalCreateNode($node);

  // $this->assertText('Group Group A has been created.');
  // Test whether first-time save actually works.
  // $this->assertEqual('og_public', unserialize(db_query('SELECT value from {spaces_overrides} WHERE id = :id', array(':id' => 1))->fetchField()));
  $this
    ->assertEqual($group->og_public, TRUE);
  $this
    ->assertEqual($group->og_private, FALSE);
}