diff options
author | Dhruv <dhruv.goel92@gmail.com> | 2013-11-08 23:11:05 +0530 |
---|---|---|
committer | Dhruv <dhruv.goel92@gmail.com> | 2014-03-12 11:02:06 +0530 |
commit | b5310e95652f009e98d720f0db92fd1cf2551fa8 (patch) | |
tree | 667f2e3305d42552a2e66c8865664203427f6c43 /tests | |
parent | 932e0eb17e9d1869eb4b1e76100c6848823780d0 (diff) | |
download | forums-b5310e95652f009e98d720f0db92fd1cf2551fa8.tar forums-b5310e95652f009e98d720f0db92fd1cf2551fa8.tar.gz forums-b5310e95652f009e98d720f0db92fd1cf2551fa8.tar.bz2 forums-b5310e95652f009e98d720f0db92fd1cf2551fa8.tar.xz forums-b5310e95652f009e98d720f0db92fd1cf2551fa8.zip |
[ticket/11040] Add methods to delete post and topic in functional tests
PHPBB3-11040
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index e40efdec03..85ff47a1f8 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -982,6 +982,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 * * @param string $url |