function DrupalForumTestCase::createForum in SimpleTest 6
4 calls to DrupalForumTestCase::createForum()
File
- tests/
forum_module.test, line 46
Class
Code
function createForum() {
// 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 forum
$this
->drupalPost('admin/content/forum/add/forum', $edit, 'Save');
$type = t('forum');
$this
->assertWantedRaw(t('Created new @type %term.', array(
'%term' => $title,
'@type' => $type,
)), t('New forum has been created'));
// Grab the newly created forum
$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 forum
$this
->assertTrue(!empty($term), 'The forum actually exists in the database');
return $term;
}