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