1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 03:54:10 +01:00

[ticket/11040] Add methods to delete post and topic in functional tests

PHPBB3-11040
This commit is contained in:
Dhruv 2013-11-08 23:11:05 +05:30
parent 932e0eb17e
commit b5310e9565

View File

@ -981,6 +981,50 @@ class phpbb_functional_test_case extends phpbb_test_case
);
}
/**
* Deletes a topic
*
* Be sure to login before creating
*
* @param int $topic_id
* @return null
*/
public function delete_topic($topic_id)
{
$crawler = self::request('GET', "viewtopic.php?t={$topic_id}&sid={$this->sid}");
$this->add_lang('posting');
$form = $crawler->selectButton('Go')->eq(1)->form();
$form['action']->select('delete_topic');
$crawler = self::submit($form);
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
$this->add_lang('mcp');
$form = $crawler->selectButton('Yes')->form();
$crawler = self::submit($form);
$this->assertContainsLang('TOPIC_DELETED_SUCCESS', $crawler->text());
}
/**
* Deletes a post
*
* Be sure to login before creating
*
* @param int $forum_id
* @param int $topic_id
* @return null
*/
public function delete_post($forum_id, $post_id)
{
$this->add_lang('posting');
$crawler = self::request('GET', "posting.php?mode=delete&f={$forum_id}&p={$post_id}&sid={$this->sid}");
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
$form = $crawler->selectButton('Yes')->form();
$crawler = self::submit($form);
$this->assertContainsLang('POST_DELETED', $crawler->text());
}
/**
* Returns the requested parameter from a URL
*