diff --git a/tests/content_visibility/fixtures/set_post_visibility.xml b/tests/content_visibility/fixtures/set_post_visibility.xml
index 5f792d0f05..1b8dac2670 100644
--- a/tests/content_visibility/fixtures/set_post_visibility.xml
+++ b/tests/content_visibility/fixtures/set_post_visibility.xml
@@ -10,6 +10,7 @@
topic_posts_approved
topic_posts_softdeleted
topic_posts_unapproved
+ topic_attachment
1
1
@@ -20,6 +21,7 @@
1
1
1
+ 0
@@ -32,6 +34,7 @@
1
1
1
+ 0
@@ -44,6 +47,33 @@
1
0
0
+ 0
+
+
+
+ 10
+ 10
+ 1
+ Only 3 posts (2 with attachments)
+ 10
+ 12
+ 3
+ 0
+ 0
+ 1
+
+
+
+ 11
+ 10
+ 1
+ Only 2 posts (1 with attachments)
+ 13
+ 14
+ 3
+ 0
+ 0
+ 1
@@ -53,6 +83,7 @@
forum_id
post_visibility
post_text
+ post_attachment
1
1
@@ -60,6 +91,7 @@
1
0
Unapproved
+ 0
2
@@ -68,6 +100,7 @@
1
1
Approved
+ 0
3
@@ -76,6 +109,7 @@
1
2
Softdeleted
+ 0
@@ -85,6 +119,7 @@
1
0
Unapproved
+ 0
5
@@ -93,6 +128,7 @@
1
1
Approved
+ 0
6
@@ -101,6 +137,7 @@
1
1
Approved 2
+ 0
7
@@ -109,6 +146,7 @@
1
2
Softdeleted
+ 0
8
@@ -117,6 +155,52 @@
1
1
Approved
+ 0
+
+
+ 10
+ 1
+ 10
+ 10
+ 1
+ Softdeleted
+ 1
+
+
+ 11
+ 1
+ 10
+ 10
+ 1
+ Softdeleted
+ 1
+
+
+ 12
+ 1
+ 10
+ 10
+ 1
+ Approved
+ 0
+
+
+ 13
+ 1
+ 11
+ 10
+ 1
+ Approved
+ 1
+
+
+ 14
+ 1
+ 11
+ 10
+ 1
+ Approved
+ 0
diff --git a/tests/content_visibility/set_post_visibility_test.php b/tests/content_visibility/set_post_visibility_test.php
index f81b83ff86..be4571bdfe 100644
--- a/tests/content_visibility/set_post_visibility_test.php
+++ b/tests/content_visibility/set_post_visibility_test.php
@@ -140,4 +140,45 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t
$this->assertEquals($expected_topic, $db->sql_fetchrowset($result));
$db->sql_freeresult($result);
}
+
+ public function set_post_soft_deleted_data()
+ {
+ return array(
+ array(
+ 10, 10, 10,
+ 1, time(), 'soft-deleted',
+ true, false,
+ array(array('topic_attachment' => 1)),
+ ),
+ array(
+ 13, 11, 10,
+ 1, time(), 'soft-deleted',
+ true, false,
+ array(array('topic_attachment' => 0)),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider set_post_soft_deleted_data
+ */
+ public function test_set_post_soft_deleted($post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest, $expected)
+ {
+ global $cache, $db, $auth, $phpbb_root_path, $phpEx;
+
+ $cache = new phpbb_mock_cache;
+ $db = $this->new_dbal();
+ $auth = $this->getMock('\phpbb\auth\auth');
+ $user = $this->getMock('\phpbb\user');
+ $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
+
+ $content_visibility->set_post_visibility(ITEM_DELETED, $post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest);
+
+ $result = $db->sql_query('SELECT topic_attachment
+ FROM phpbb_topics
+ WHERE topic_id = ' . $topic_id);
+
+ $this->assertEquals($expected, $db->sql_fetchrowset($result));
+ $db->sql_freeresult($result);
+ }
}