From 4c2b4b4145d88627c48ddcd88a71a76e58f4dfe2 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 7 Aug 2014 18:36:50 +0200 Subject: [ticket/12718] Add tests to check user_posts on post deletion PHPBB3-12718 --- tests/content_visibility/delete_post_test.php | 35 +++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php index aa705c52a5..e85fbd3fc7 100644 --- a/tests/content_visibility/delete_post_test.php +++ b/tests/content_visibility/delete_post_test.php @@ -67,6 +67,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3), ), + array( + array('user_posts' => 3), + ), ), array( 1, 1, 1, @@ -93,6 +96,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3), ), + array( + array('user_posts' => 3), + ), ), array( 1, 1, 3, @@ -119,6 +125,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 2), ), + array( + array('user_posts' => 3), + ), ), array( 1, 1, 2, @@ -145,6 +154,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3), ), + array( + array('user_posts' => 3), + ), ), array( 1, 1, 1, @@ -171,6 +183,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3), ), + array( + array('user_posts' => 3), + ), ), array( 1, 1, 3, @@ -197,6 +212,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 2), ), + array( + array('user_posts' => 3), + ), ), array( @@ -222,6 +240,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( 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), ), + array( + array('user_posts' => 3), + ), ), array( @@ -255,7 +276,10 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case ), ), array( - array('forum_posts_approved' => 0, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 0, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 1, 'forum_last_post_id' => 0), + array('forum_posts_approved'=> 0, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 0, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 1, 'forum_last_post_id' => 0), + ), + array( + array('user_posts' => 3), ), ), ); @@ -264,7 +288,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case /** * @dataProvider delete_post_data */ - public function test_delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason, $expected_posts, $expected_topic, $expected_forum) + public function test_delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason, $expected_posts, $expected_topic, $expected_forum, $expected_user) { global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx; @@ -313,5 +337,12 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case $this->assertEquals($expected_forum, $db->sql_fetchrowset($result)); $db->sql_freeresult($result); + + $result = $db->sql_query('SELECT user_posts + FROM phpbb_users + WHERE user_id = ' . $data['poster_id']); + + $this->assertEquals($expected_user, $db->sql_fetchrowset($result)); + $db->sql_freeresult($result); } } -- cgit v1.2.1