mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-29 06:38:52 +00:00
[feature/soft-delete] Update unit tests to new table structure
PHPBB3-9567
This commit is contained in:
parent
727759c4d8
commit
3236229188
2 changed files with 59 additions and 34 deletions
|
@ -26,7 +26,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||||
$info_data = array(
|
$info_data = array(
|
||||||
'topic_first_post_id' => 1,
|
'topic_first_post_id' => 1,
|
||||||
'topic_last_post_id' => 3,
|
'topic_last_post_id' => 3,
|
||||||
'topic_replies_real' => 3,
|
'topic_posts' => 3,
|
||||||
|
'topic_posts_unapproved' => 0,
|
||||||
|
'topic_posts_softdeleted' => 0,
|
||||||
'topic_visibility' => ITEM_APPROVED,
|
'topic_visibility' => ITEM_APPROVED,
|
||||||
'post_time' => 2,
|
'post_time' => 2,
|
||||||
'post_visibility' => ITEM_APPROVED,
|
'post_visibility' => ITEM_APPROVED,
|
||||||
|
@ -52,13 +54,14 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||||
'topic_visibility' => ITEM_APPROVED,
|
'topic_visibility' => ITEM_APPROVED,
|
||||||
'topic_first_post_id' => 1,
|
'topic_first_post_id' => 1,
|
||||||
'topic_last_post_id' => 3,
|
'topic_last_post_id' => 3,
|
||||||
'topic_replies' => 1,
|
'topic_posts' => 2,
|
||||||
'topic_replies_real' => 1,
|
'topic_posts_unapproved' => 0,
|
||||||
|
'topic_posts_softdeleted' => 0,
|
||||||
'topic_delete_reason' => '',
|
'topic_delete_reason' => '',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array('forum_posts' => 2, 'forum_topics' => 1, 'forum_topics_real' => 1, 'forum_last_post_id' => 3),
|
array('forum_posts' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
@ -77,13 +80,14 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||||
'topic_visibility' => ITEM_APPROVED,
|
'topic_visibility' => ITEM_APPROVED,
|
||||||
'topic_first_post_id' => 2,
|
'topic_first_post_id' => 2,
|
||||||
'topic_last_post_id' => 3,
|
'topic_last_post_id' => 3,
|
||||||
'topic_replies' => 1,
|
'topic_posts' => 2,
|
||||||
'topic_replies_real' => 1,
|
'topic_posts_unapproved' => 0,
|
||||||
|
'topic_posts_softdeleted' => 0,
|
||||||
'topic_delete_reason' => '',
|
'topic_delete_reason' => '',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array('forum_posts' => 2, 'forum_topics' => 1, 'forum_topics_real' => 1, 'forum_last_post_id' => 3),
|
array('forum_posts' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
@ -102,13 +106,14 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||||
'topic_visibility' => ITEM_APPROVED,
|
'topic_visibility' => ITEM_APPROVED,
|
||||||
'topic_first_post_id' => 1,
|
'topic_first_post_id' => 1,
|
||||||
'topic_last_post_id' => 2,
|
'topic_last_post_id' => 2,
|
||||||
'topic_replies' => 1,
|
'topic_posts' => 2,
|
||||||
'topic_replies_real' => 1,
|
'topic_posts_unapproved' => 0,
|
||||||
|
'topic_posts_softdeleted' => 0,
|
||||||
'topic_delete_reason' => '',
|
'topic_delete_reason' => '',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array('forum_posts' => 2, 'forum_topics' => 1, 'forum_topics_real' => 1, 'forum_last_post_id' => 2),
|
array('forum_posts' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
@ -127,13 +132,14 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||||
'topic_visibility' => ITEM_APPROVED,
|
'topic_visibility' => ITEM_APPROVED,
|
||||||
'topic_first_post_id' => 1,
|
'topic_first_post_id' => 1,
|
||||||
'topic_last_post_id' => 3,
|
'topic_last_post_id' => 3,
|
||||||
'topic_replies' => 1,
|
'topic_posts' => 2,
|
||||||
'topic_replies_real' => 2,
|
'topic_posts_unapproved' => 0,
|
||||||
|
'topic_posts_softdeleted' => 1,
|
||||||
'topic_delete_reason' => '',
|
'topic_delete_reason' => '',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array('forum_posts' => 2, 'forum_topics' => 1, 'forum_topics_real' => 1, 'forum_last_post_id' => 3),
|
array('forum_posts' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
@ -152,13 +158,14 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||||
'topic_visibility' => ITEM_APPROVED,
|
'topic_visibility' => ITEM_APPROVED,
|
||||||
'topic_first_post_id' => 2,
|
'topic_first_post_id' => 2,
|
||||||
'topic_last_post_id' => 3,
|
'topic_last_post_id' => 3,
|
||||||
'topic_replies' => 1,
|
'topic_posts' => 2,
|
||||||
'topic_replies_real' => 2,
|
'topic_posts_unapproved' => 0,
|
||||||
|
'topic_posts_softdeleted' => 1,
|
||||||
'topic_delete_reason' => '',
|
'topic_delete_reason' => '',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array('forum_posts' => 2, 'forum_topics' => 1, 'forum_topics_real' => 1, 'forum_last_post_id' => 3),
|
array('forum_posts' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
@ -177,13 +184,14 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||||
'topic_visibility' => ITEM_APPROVED,
|
'topic_visibility' => ITEM_APPROVED,
|
||||||
'topic_first_post_id' => 1,
|
'topic_first_post_id' => 1,
|
||||||
'topic_last_post_id' => 2,
|
'topic_last_post_id' => 2,
|
||||||
'topic_replies' => 1,
|
'topic_posts' => 2,
|
||||||
'topic_replies_real' => 2,
|
'topic_posts_unapproved' => 0,
|
||||||
|
'topic_posts_softdeleted' => 1,
|
||||||
'topic_delete_reason' => '',
|
'topic_delete_reason' => '',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array('forum_posts' => 2, 'forum_topics' => 1, 'forum_topics_real' => 1, 'forum_last_post_id' => 2),
|
array('forum_posts' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -192,7 +200,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||||
array(
|
array(
|
||||||
'topic_first_post_id' => 4,
|
'topic_first_post_id' => 4,
|
||||||
'topic_last_post_id' => 4,
|
'topic_last_post_id' => 4,
|
||||||
'topic_replies_real' => 0,
|
'topic_posts' => 1,
|
||||||
|
'topic_posts_unapproved' => 0,
|
||||||
|
'topic_posts_softdeleted' => 0,
|
||||||
'topic_visibility' => ITEM_APPROVED,
|
'topic_visibility' => ITEM_APPROVED,
|
||||||
'post_time' => 4,
|
'post_time' => 4,
|
||||||
'post_visibility' => ITEM_APPROVED,
|
'post_visibility' => ITEM_APPROVED,
|
||||||
|
@ -206,7 +216,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||||
array(
|
array(
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array('forum_posts' => 0, 'forum_topics' => 0, 'forum_topics_real' => 0, 'forum_last_post_id' => 0),
|
array('forum_posts' => 0, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics' => 0, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -215,7 +225,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||||
array(
|
array(
|
||||||
'topic_first_post_id' => 4,
|
'topic_first_post_id' => 4,
|
||||||
'topic_last_post_id' => 4,
|
'topic_last_post_id' => 4,
|
||||||
'topic_replies_real' => 0,
|
'topic_posts' => 1,
|
||||||
|
'topic_posts_unapproved' => 0,
|
||||||
|
'topic_posts_softdeleted' => 0,
|
||||||
'topic_visibility' => ITEM_APPROVED,
|
'topic_visibility' => ITEM_APPROVED,
|
||||||
'post_time' => 4,
|
'post_time' => 4,
|
||||||
'post_visibility' => ITEM_APPROVED,
|
'post_visibility' => ITEM_APPROVED,
|
||||||
|
@ -232,13 +244,14 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||||
'topic_visibility' => ITEM_DELETED,
|
'topic_visibility' => ITEM_DELETED,
|
||||||
'topic_first_post_id' => 4,
|
'topic_first_post_id' => 4,
|
||||||
'topic_last_post_id' => 4,
|
'topic_last_post_id' => 4,
|
||||||
'topic_replies' => 0,
|
'topic_posts' => 0,
|
||||||
'topic_replies_real' => 0,
|
'topic_posts_unapproved' => 0,
|
||||||
|
'topic_posts_softdeleted' => 1,
|
||||||
'topic_delete_reason' => 'soft delete',
|
'topic_delete_reason' => 'soft delete',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array('forum_posts' => 0, 'forum_topics' => 0, 'forum_topics_real' => 1, 'forum_last_post_id' => 0),
|
array('forum_posts' => 0, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics' => 0, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 1, 'forum_last_post_id' => 0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -274,14 +287,14 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||||
$this->assertEquals($expected_posts, $db->sql_fetchrowset($result));
|
$this->assertEquals($expected_posts, $db->sql_fetchrowset($result));
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$result = $db->sql_query('SELECT topic_visibility, topic_first_post_id, topic_last_post_id, topic_replies, topic_replies_real, topic_delete_reason
|
$result = $db->sql_query('SELECT topic_visibility, topic_first_post_id, topic_last_post_id, topic_posts, topic_posts_unapproved, topic_posts_softdeleted, topic_delete_reason
|
||||||
FROM phpbb_topics
|
FROM phpbb_topics
|
||||||
WHERE topic_id = ' . $topic_id);
|
WHERE topic_id = ' . $topic_id);
|
||||||
|
|
||||||
$this->assertEquals($expected_topic, $db->sql_fetchrowset($result));
|
$this->assertEquals($expected_topic, $db->sql_fetchrowset($result));
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$result = $db->sql_query('SELECT forum_posts, forum_topics, forum_topics_real, forum_last_post_id
|
$result = $db->sql_query('SELECT forum_posts, forum_posts_unapproved, forum_posts_softdeleted, forum_topics, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id
|
||||||
FROM phpbb_forums
|
FROM phpbb_forums
|
||||||
WHERE forum_id = ' . $forum_id);
|
WHERE forum_id = ' . $forum_id);
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,11 @@
|
||||||
<table name="phpbb_forums">
|
<table name="phpbb_forums">
|
||||||
<column>forum_id</column>
|
<column>forum_id</column>
|
||||||
<column>forum_posts</column>
|
<column>forum_posts</column>
|
||||||
|
<column>forum_posts_unapproved</column>
|
||||||
|
<column>forum_posts_softdeleted</column>
|
||||||
<column>forum_topics</column>
|
<column>forum_topics</column>
|
||||||
<column>forum_topics_real</column>
|
<column>forum_topics_unapproved</column>
|
||||||
|
<column>forum_topics_softdeleted</column>
|
||||||
<column>forum_last_post_id</column>
|
<column>forum_last_post_id</column>
|
||||||
<column>forum_desc</column>
|
<column>forum_desc</column>
|
||||||
<column>forum_rules</column>
|
<column>forum_rules</column>
|
||||||
|
@ -12,8 +15,11 @@
|
||||||
<row>
|
<row>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
<value>3</value>
|
<value>3</value>
|
||||||
|
<value>0</value>
|
||||||
|
<value>0</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
<value>1</value>
|
<value>0</value>
|
||||||
|
<value>0</value>
|
||||||
<value>3</value>
|
<value>3</value>
|
||||||
<value></value>
|
<value></value>
|
||||||
<value></value>
|
<value></value>
|
||||||
|
@ -21,8 +27,11 @@
|
||||||
<row>
|
<row>
|
||||||
<value>2</value>
|
<value>2</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
|
<value>0</value>
|
||||||
|
<value>0</value>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
<value>1</value>
|
<value>0</value>
|
||||||
|
<value>0</value>
|
||||||
<value>4</value>
|
<value>4</value>
|
||||||
<value></value>
|
<value></value>
|
||||||
<value></value>
|
<value></value>
|
||||||
|
@ -38,8 +47,9 @@
|
||||||
<column>topic_delete_user</column>
|
<column>topic_delete_user</column>
|
||||||
<column>topic_delete_time</column>
|
<column>topic_delete_time</column>
|
||||||
<column>topic_delete_reason</column>
|
<column>topic_delete_reason</column>
|
||||||
<column>topic_replies</column>
|
<column>topic_posts</column>
|
||||||
<column>topic_replies_real</column>
|
<column>topic_posts_unapproved</column>
|
||||||
|
<column>topic_posts_softdeleted</column>
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
|
@ -51,8 +61,9 @@
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
<value></value>
|
<value></value>
|
||||||
<value>2</value>
|
<value>3</value>
|
||||||
<value>2</value>
|
<value>0</value>
|
||||||
|
<value>0</value>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<value>2</value>
|
<value>2</value>
|
||||||
|
@ -64,6 +75,7 @@
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
<value></value>
|
<value></value>
|
||||||
|
<value>1</value>
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
</row>
|
</row>
|
||||||
|
|
Loading…
Add table
Reference in a new issue