Tests that forum nodes can't be added without a parent.
Verifies that forum nodes are not created without choosing "forum" from the select list.
function testAddOrphanTopic() {
// Must remove forum topics to test creating orphan topics.
$vid = config('forum.settings')
->get('vocabulary');
$tree = taxonomy_get_tree($vid);
foreach ($tree as $term) {
taxonomy_term_delete($term->tid);
}
// Create an orphan forum item.
$this
->drupalLogin($this->admin_user);
$this
->drupalPost('node/add/forum', array(
'title' => $this
->randomName(10),
'body[' . LANGUAGE_NOT_SPECIFIED . '][0][value]' => $this
->randomName(120),
), t('Save'));
$nid_count = db_query('SELECT COUNT(nid) FROM {node}')
->fetchField();
$this
->assertEqual(0, $nid_count, 'A forum node was not created when missing a forum vocabulary.');
// Reset the defaults for future tests.
module_enable(array(
'forum',
));
}