You are here

function DrupalForumTestCase::createForumContainer in SimpleTest 6

2 calls to DrupalForumTestCase::createForumContainer()
AddForumTest::testAddForumContainer in tests/forum_module.test
AddTopicToForum::testAddTopicToContainer in tests/forum_module.test

File

tests/forum_module.test, line 20

Class

DrupalForumTestCase

Code

function createForumContainer() {

  // Generate a random name/description
  $title = $this
    ->randomName(10);
  $description = $this
    ->randomName(100);
  $edit = array(
    'name' => $title,
    'description' => $description,
    'parent[0]' => '0',
    'weight' => '0',
  );

  // Double check that the page says it has created the container
  $this
    ->drupalPost('admin/content/forum/add/container', $edit, 'Save');
  $type = t('forum container');
  $this
    ->assertWantedRaw(t('Created new @type %term.', array(
    '%term' => $title,
    '@type' => $type,
  )), t('New forum container has been created'));

  // Grab the newly created container
  $term = db_fetch_array(db_query("SELECT * FROM {term_data} t WHERE t.vid = %d AND t.name = '%s' AND t.description = '%s'", variable_get('forum_nav_vocabulary', ''), $title, $description));

  // Make sure we actually found a container
  $this
    ->assertTrue(!empty($term), 'The container actually exists in the database');
  return $term;
}