aboutsummaryrefslogtreecommitdiffstats
path: root/tests/content_visibility/get_visibility_sql_test.php
diff options
context:
space:
mode:
authorv12mike <v12mike@ingenious.co.nz>2019-11-04 09:21:27 -0500
committerMarc Alexander <admin@m-a-styles.de>2019-11-21 13:44:22 +0100
commit0f57f3d90d1983c49bde1d56b6018a761f92264b (patch)
tree9d457a0b124b8df77411bdbd5715050d3262c8f2 /tests/content_visibility/get_visibility_sql_test.php
parent4d156837332707542bed6899cbf872c441f7bd96 (diff)
downloadforums-0f57f3d90d1983c49bde1d56b6018a761f92264b.tar
forums-0f57f3d90d1983c49bde1d56b6018a761f92264b.tar.gz
forums-0f57f3d90d1983c49bde1d56b6018a761f92264b.tar.bz2
forums-0f57f3d90d1983c49bde1d56b6018a761f92264b.tar.xz
forums-0f57f3d90d1983c49bde1d56b6018a761f92264b.zip
[ticket/9837] Display unapproved posts to their authors
Coding guidelines fixes PHPBB3-9837
Diffstat (limited to 'tests/content_visibility/get_visibility_sql_test.php')
-rw-r--r--tests/content_visibility/get_visibility_sql_test.php38
1 files changed, 20 insertions, 18 deletions
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);
}
}