You are here

function OgTestCase::addOg in Organic groups 5.7

Same name and namespace in other branches
  1. 5.8 tests/og_testcase.php \OgTestCase::addOg()
  2. 5 tests/og_testcase.php \OgTestCase::addOg()
  3. 5.2 tests/og_testcase.php \OgTestCase::addOg()
  4. 5.3 tests/og_testcase.php \OgTestCase::addOg()
2 calls to OgTestCase::addOg()
OgPost::testOgPost in tests/og_post.test
OgSubscribe::testAddOg in tests/og_subscribe.test

File

tests/og_testcase.php, line 10

Class

OgTestCase

Code

function addOg($type, $selective = OG_OPEN) {
  $edit = array();
  $edit['title'] = '!SimpleTest test group node! ' . $this
    ->randomName(10);
  $edit['og_description'] = '!SimpleTest og description' . $this
    ->randomName(10);
  $edit['body'] = '!SimpleTest test group welcome message! ' . $this
    ->randomName(32) . ' ' . $this
    ->randomName(32);
  $edit['og_selective'] = (string) $selective;

  //    $this->_browser->setFieldByName('edit[og_theme]', ''); // May not be present, so no error catching
  $this
    ->drupalPostRequest("node/add/{$type}", $edit, 'Submit');
  $this
    ->assertWantedRaw(t('Your %post has been created.', array(
    '%post' => $type,
  )), 'Group created');
  $node = node_load(array(
    'title' => $edit['title'],
  ));
  $this
    ->assertNotNull($node, 'Group found in database. %s');
  $this->_cleanupGroups[] = $node->nid;
  return $node->nid;
}