aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-07-12 21:20:33 -0400
committerJoas Schilling <nickvergessen@gmx.de>2013-07-12 21:20:33 -0400
commita01d8cdfa33467f580edb77dbd10185de556cce2 (patch)
tree8e484bf28cea7cef864a0bd0b878208731e0d8cd
parent8c5ff0775a4563f2a4ad1e7f30379576e1c5ca21 (diff)
downloadforums-a01d8cdfa33467f580edb77dbd10185de556cce2.tar
forums-a01d8cdfa33467f580edb77dbd10185de556cce2.tar.gz
forums-a01d8cdfa33467f580edb77dbd10185de556cce2.tar.bz2
forums-a01d8cdfa33467f580edb77dbd10185de556cce2.tar.xz
forums-a01d8cdfa33467f580edb77dbd10185de556cce2.zip
[ticket/9657] Add functional test for restoring a post/topic
PHPBB3-9657
-rw-r--r--tests/functional/softdelete_test.php73
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/functional/softdelete_test.php b/tests/functional/softdelete_test.php
index 0ebbab66ab..b42c52b5cf 100644
--- a/tests/functional/softdelete_test.php
+++ b/tests/functional/softdelete_test.php
@@ -370,6 +370,79 @@ class phpbb_functional_softdelete_test extends phpbb_functional_test_case
), 'after moving #2');
}
+ public function test_restore_post()
+ {
+ $this->login();
+ $this->load_ids(array(
+ 'forums' => array(
+ 'Soft Delete #1',
+ 'Soft Delete #2',
+ ),
+ 'topics' => array(
+ 'Soft Delete Topic #1',
+ ),
+ 'posts' => array(
+ 'Soft Delete Topic #1',
+ 'Re: Soft Delete Topic #1-#2',
+ ),
+ ));
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 2,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 1,
+ 'forum_last_post_id' => 0,
+ ), 'before restoring #1');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => 0,
+ ), 'before restoring #2');
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+
+ $this->add_lang('mcp');
+ $form = $crawler->selectButton($this->lang('RESTORE'))->form();
+ $crawler = self::submit($form);
+ $this->assertContainsLang('RESTORE_POST', $crawler->text());
+
+ $form = $crawler->selectButton('Yes')->form();
+ $crawler = self::submit($form);
+ $this->assertContainsLang('POST_RESTORED_SUCCESS', $crawler->text());
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+ $this->assertContains('Soft Delete #1', $crawler->filter('.navlinks')->text());
+ $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text());
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'after restoring #1');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => 0,
+ ), 'after restoring #2');
+ }
+
public function assert_forum_details($forum_id, $details, $additional_error_message = '')
{
$this->db = $this->get_db();