aboutsummaryrefslogtreecommitdiffstats
path: root/tests/content_visibility
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-10-05 12:37:01 +0200
committerJoas Schilling <nickvergessen@gmx.de>2012-10-05 12:39:05 +0200
commit63d11c976b0bcef68ce4809c8c76124451df88ea (patch)
treec7627d8ef061678054764354cdecc1094e1cd4fa /tests/content_visibility
parent2a81e4b48ee223d8538e960b6e8e6e1c3e1277b2 (diff)
downloadforums-63d11c976b0bcef68ce4809c8c76124451df88ea.tar
forums-63d11c976b0bcef68ce4809c8c76124451df88ea.tar.gz
forums-63d11c976b0bcef68ce4809c8c76124451df88ea.tar.bz2
forums-63d11c976b0bcef68ce4809c8c76124451df88ea.tar.xz
forums-63d11c976b0bcef68ce4809c8c76124451df88ea.zip
[feature/soft-delete] Fix sync('topic') to match the new logic
This also fixes set_post_visibility() PHPBB3-9567
Diffstat (limited to 'tests/content_visibility')
-rw-r--r--tests/content_visibility/fixtures/set_post_visibility.xml17
-rw-r--r--tests/content_visibility/set_post_visibility_test.php48
2 files changed, 60 insertions, 5 deletions
diff --git a/tests/content_visibility/fixtures/set_post_visibility.xml b/tests/content_visibility/fixtures/set_post_visibility.xml
index 3859d17955..6fec5c5ad1 100644
--- a/tests/content_visibility/fixtures/set_post_visibility.xml
+++ b/tests/content_visibility/fixtures/set_post_visibility.xml
@@ -24,6 +24,15 @@
<value>5</value>
<value>6</value>
</row>
+
+ <row>
+ <value>3</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Only 1 Approved posts</value>
+ <value>8</value>
+ <value>8</value>
+ </row>
</table>
<table name="phpbb_posts">
<column>post_id</column>
@@ -89,6 +98,14 @@
<value>2</value>
<value>Softdeleted</value>
</row>
+ <row>
+ <value>8</value>
+ <value>1</value>
+ <value>3</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Approved</value>
+ </row>
</table>
<table name="phpbb_users">
<column>user_id</column>
diff --git a/tests/content_visibility/set_post_visibility_test.php b/tests/content_visibility/set_post_visibility_test.php
index c488c648bc..0fc2f349c0 100644
--- a/tests/content_visibility/set_post_visibility_test.php
+++ b/tests/content_visibility/set_post_visibility_test.php
@@ -34,7 +34,7 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t
array('post_id' => 3, 'post_visibility' => 2, 'post_delete_reason' => ''),
),
array(
- array('topic_visibility' => 1, 'topic_first_post_id' => '1', 'topic_last_post_id' => '2'),
+ array('topic_visibility' => 1, 'topic_first_post_id' => 1, 'topic_last_post_id' => 2),
),
),
array(
@@ -48,7 +48,21 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t
array('post_id' => 3, 'post_visibility' => 1, 'post_delete_reason' => 'approve'),
),
array(
- array('topic_visibility' => 1, 'topic_first_post_id' => '2', 'topic_last_post_id' => '3'),
+ array('topic_visibility' => 1, 'topic_first_post_id' => 2, 'topic_last_post_id' => 3),
+ ),
+ ),
+ array(
+ ITEM_DELETED,
+ 2, 1, 1,
+ 2, time(), 'deleted',
+ true, true,
+ array(
+ array('post_id' => 1, 'post_visibility' => 0, 'post_delete_reason' => ''),
+ array('post_id' => 2, 'post_visibility' => 2, 'post_delete_reason' => 'deleted'),
+ array('post_id' => 3, 'post_visibility' => 2, 'post_delete_reason' => ''),
+ ),
+ array(
+ array('topic_visibility' => 0, 'topic_first_post_id' => 1, 'topic_last_post_id' => 3),
),
),
array(
@@ -63,7 +77,7 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t
array('post_id' => 7, 'post_visibility' => 2, 'post_delete_reason' => ''),
),
array(
- array('topic_visibility' => 1, 'topic_first_post_id' => '6', 'topic_last_post_id' => '6'),
+ array('topic_visibility' => 1, 'topic_first_post_id' => 6, 'topic_last_post_id' => 6),
),
),
array(
@@ -73,12 +87,36 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t
false, true,
array(
array('post_id' => 4, 'post_visibility' => 0, 'post_delete_reason' => ''),
- array('post_id' => 5, 'post_visibility' => 1, 'post_delete_reason' => 'deleted'),
+ array('post_id' => 5, 'post_visibility' => 1, 'post_delete_reason' => ''),
array('post_id' => 6, 'post_visibility' => 2, 'post_delete_reason' => 'deleted'),
array('post_id' => 7, 'post_visibility' => 2, 'post_delete_reason' => ''),
),
array(
- array('topic_visibility' => 1, 'topic_first_post_id' => '5', 'topic_last_post_id' => '5'),
+ array('topic_visibility' => 1, 'topic_first_post_id' => 5, 'topic_last_post_id' => 5),
+ ),
+ ),
+ array(
+ ITEM_DELETED,
+ 8, 3, 1,
+ 2, time(), 'deleted',
+ true, true,
+ array(
+ array('post_id' => 8, 'post_visibility' => 2, 'post_delete_reason' => 'deleted'),
+ ),
+ array(
+ array('topic_visibility' => 2, 'topic_first_post_id' => 8, 'topic_last_post_id' => 8),
+ ),
+ ),
+ array(
+ ITEM_UNAPPROVED,
+ 8, 3, 1,
+ 2, time(), 'unapproved',
+ true, true,
+ array(
+ array('post_id' => 8, 'post_visibility' => 0, 'post_delete_reason' => 'unapproved'),
+ ),
+ array(
+ array('topic_visibility' => 0, 'topic_first_post_id' => 8, 'topic_last_post_id' => 8),
),
),
);