mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-25 04:23:38 +01:00
[ticket/9657] Add functional test for restoring a post/topic
PHPBB3-9657
This commit is contained in:
parent
8c5ff0775a
commit
a01d8cdfa3
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user