From 0f57f3d90d1983c49bde1d56b6018a761f92264b Mon Sep 17 00:00:00 2001 From: v12mike Date: Mon, 4 Nov 2019 09:21:27 -0500 Subject: [ticket/9837] Display unapproved posts to their authors Coding guidelines fixes PHPBB3-9837 --- .../content_visibility/get_visibility_sql_test.php | 38 ++++++++++++---------- 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'tests/content_visibility/get_visibility_sql_test.php') diff --git a/tests/content_visibility/get_visibility_sql_test.php b/tests/content_visibility/get_visibility_sql_test.php index def4ed3718..6026778487 100644 --- a/tests/content_visibility/get_visibility_sql_test.php +++ b/tests/content_visibility/get_visibility_sql_test.php @@ -24,8 +24,8 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te // data set 0: display_unapproved_posts=false, moderator, can see all posts array( 'phpbb_posts', - 0, - false, + 0, + false, 'post', 1, '', array( array('m_approve', 1, true), @@ -37,11 +37,11 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te array('post_id' => 4), ), ), - // data set 1: display_unapproved_posts=false, normal user, cannot see any unapproved posts + // data set 1: display_unapproved_posts=false, normal user, cannot see any unapproved posts array( 'phpbb_posts', 0, - false, + false, 'post', 1, '', array( ), @@ -53,7 +53,7 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te array( 'phpbb_topics', 0, - false, + false, 'topic', 1, '', array( array('m_approve', 1, true), @@ -65,22 +65,22 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te array('topic_id' => 4), ), ), - // data set 3: display_unapproved_posts=false, normal user, cannot see unapproved posts topic + // data set 3: display_unapproved_posts=false, normal user, cannot see unapproved posts topic array( 'phpbb_topics', 0, - false, + false, 'topic', 1, '', array(), array( array('topic_id' => 2), ), ), - // data set 4: display_unapproved_posts=true, guest user, cannot see unapproved posts + // data set 4: display_unapproved_posts=true, guest user, cannot see unapproved posts array( 'phpbb_posts', 1, - true, + true, 'post', 1, '', array( ), @@ -88,22 +88,22 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te array('post_id' => 2), ), ), - // data set 5: display_unapproved_posts=true, guest user, cannot see unapproved posts topic + // data set 5: display_unapproved_posts=true, guest user, cannot see unapproved posts topic array( 'phpbb_topics', 1, - true, + true, 'topic', 1, '', array(), array( array('topic_id' => 2), ), ), - // data set 6: display_unapproved_posts=true, normal user, can see own unapproved posts + // data set 6: display_unapproved_posts=true, normal user, can see own unapproved posts array( 'phpbb_posts', - 0, - true, + 0, + true, 'post', 1, '', array(), array( @@ -111,11 +111,11 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te array('post_id' => 2), ), ), - // data set 7: display_unapproved_posts=true, normal user, can see own unapproved posts topic + // data set 7: display_unapproved_posts=true, normal user, can see own unapproved posts topic array( 'phpbb_topics', 0, - true, + true, 'topic', 1, '', array(), array( @@ -152,11 +152,13 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $content_visibility = new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); - $result = $db->sql_query('SELECT ' . $mode . '_id + $sql = 'SELECT ' . $mode . '_id FROM ' . $table . ' WHERE ' . $content_visibility->get_visibility_sql($mode, $forum_id, $table_alias) . ' - ORDER BY ' . $mode . '_id ASC'); + ORDER BY ' . $mode . '_id ASC'; + $result = $db->sql_query($sql); $this->assertEquals($expected, $db->sql_fetchrowset($result)); + $db->sql_freeresult($result); } } -- cgit v1.2.1