function AddTopicToForum::testAddTopicToForum in SimpleTest 6
File
- tests/forum_module.test, line 171
Class
- AddTopicToForum
Code
function testAddTopicToForum() {
$web_user = $this
->drupalCreateUserRolePerm(array(
'access administration pages',
'administer forums',
'create forum topics',
));
$this
->drupalLoginUser($web_user);
$forum = $this
->createForum();
$title = $this
->randomName(20);
$description = $this
->randomName(200);
$edit = array(
'title' => $title,
'body' => $description,
);
$this
->drupalPost('node/add/forum/' . $forum['tid'], $edit, 'Save');
$type = t('Forum topic');
$this
->assertWantedRaw(t('@type %term has been created.', array(
'%term' => $title,
'@type' => $type,
)), t('New forum topic has been created'));
$this
->assertNoUnwantedRaw(t('The item %term is only a container for forums.', array(
'%term' => $forum['name'],
)), t('No error message shown'));
$new_topic = node_load(array(
'title' => $title,
), null, true);
$this
->drupalGet("node/{$new_topic->nid}");
$this
->assertWantedRaw($title, t('Looking for subject text'));
$this
->assertWantedRaw($description, t('Looking for body text'));
node_delete($new_topic->nid);
if (!empty($forum)) {
taxonomy_del_term($forum['tid']);
}
}