You are here

function OgTestCase::addOgPost in Organic groups 6.2

Same name and namespace in other branches
  1. 6 tests/og_testcase.php \OgTestCase::addOgPost()

Create a group post.

Parameters

$type: The content type name.

$groups: An array with the group(s) id the post should belong to.

Return value

The newly created node id.

3 calls to OgTestCase::addOgPost()
OgContext::setUp in tests/og.context.test
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.…
OgPost::testOgPost in tests/og.post.test
Test the simple case of creation of a group node and a group post by the same user.
OgWiki::testOgWiki in tests/og_wiki.test
Test the simple case of creation of a group node and a group post by the same user.

File

tests/og_testcase.php, line 53
Common functions for all the organic groups tests.

Class

OgTestCase
@file Common functions for all the organic groups tests.

Code

function addOgPost($type, $groups = array()) {
  $edit = array();
  foreach ($groups as $gid) {
    $edit['og_groups[' . $gid . ']'] = TRUE;
  }

  // Keys that should be present when the node is loaded.
  $keys = array(
    'og_groups',
    'og_groups_both',
  );
  $og_type = t('Group post');
  return $this
    ->_addOgContent($type, $og_type, $edit, $keys);
}