Changeset 6011
- Timestamp:
- 04/19/2016 10:04:37 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/forums/functions/counts.php
r5921 r6011 68 68 public function test_bbp_forum_trashed_untrashed_topic_counts() { 69 69 $f = $this->factory->forum->create(); 70 $t = $this->factory->topic->create_many( 3, array( 71 'post_parent' => $f, 72 'topic_meta' => array( 73 'forum_id' => $f, 74 ), 75 ) ); 76 $r1 = $this->factory->reply->create_many( 2, array( 70 $t = $this->factory->topic->create_many( 2, array( 71 'post_parent' => $f, 72 'topic_meta' => array( 73 'forum_id' => $f, 74 ), 75 ) ); 76 $r1 = $this->factory->reply->create_many( 1, array( 77 'post_parent' => $t[0], 78 'reply_meta' => array( 79 'forum_id' => $f, 80 'topic_id' => $t[0], 81 ), 82 ) ); 83 $r2 = $this->factory->reply->create_many( 1, array( 77 84 'post_parent' => $t[1], 78 85 'reply_meta' => array( … … 81 88 ), 82 89 ) ); 83 $r2 = $this->factory->reply->create_many( 2, array(84 'post_parent' => $t[2],85 'reply_meta' => array(86 'forum_id' => $f,87 'topic_id' => $t[2],88 ),89 ) );90 90 91 91 $count = bbp_update_forum_topic_count( $f ); 92 $this->assertSame( 3, $count );92 $this->assertSame( 2, $count ); 93 93 94 94 $count = bbp_update_forum_topic_count_hidden( $f ); … … 96 96 97 97 $count = bbp_update_forum_reply_count( $f ); 98 $this->assertSame( 4, $count );98 $this->assertSame( 2, $count ); 99 99 100 100 // ToDo: Update this to use bbp_trash_topic(). 101 wp_trash_post( $t[ 2] );102 103 $count = bbp_get_forum_topic_count( $f, true, true ); 104 $this->assertSame( 2, $count );105 106 $count = bbp_get_forum_topic_count_hidden( $f, true, true ); 107 $this->assertSame( 1, $count ); 108 109 $count = bbp_get_forum_reply_count( $f, true, true ); 110 $this->assertSame( 2, $count );101 wp_trash_post( $t[1] ); 102 103 $count = bbp_get_forum_topic_count( $f, true, true ); 104 $this->assertSame( 1, $count ); 105 106 $count = bbp_get_forum_topic_count_hidden( $f, true, true ); 107 $this->assertSame( 1, $count ); 108 109 $count = bbp_get_forum_reply_count( $f, true, true ); 110 $this->assertSame( 1, $count ); 111 111 112 112 // ToDo: Update this to use bbp_untrash_topic(). 113 wp_untrash_post( $t[ 2] );114 115 $count = bbp_get_forum_topic_count( $f, true, true ); 116 $this->assertSame( 3, $count );117 118 $count = bbp_get_forum_topic_count_hidden( $f, true, true ); 119 $this->assertSame( 0, $count ); 120 121 $count = bbp_get_forum_reply_count( $f, true, true ); 122 $this->assertSame( 4, $count );113 wp_untrash_post( $t[1] ); 114 115 $count = bbp_get_forum_topic_count( $f, true, true ); 116 $this->assertSame( 2, $count ); 117 118 $count = bbp_get_forum_topic_count_hidden( $f, true, true ); 119 $this->assertSame( 0, $count ); 120 121 $count = bbp_get_forum_reply_count( $f, true, true ); 122 $this->assertSame( 2, $count ); 123 123 } 124 124 … … 128 128 public function test_bbp_forum_spammed_unspammed_topic_counts() { 129 129 $f = $this->factory->forum->create(); 130 $t = $this->factory->topic->create_many( 3, array( 131 'post_parent' => $f, 132 'topic_meta' => array( 133 'forum_id' => $f, 134 ), 135 ) ); 136 $r1 = $this->factory->reply->create_many( 2, array( 130 $t = $this->factory->topic->create_many( 2, array( 131 'post_parent' => $f, 132 'topic_meta' => array( 133 'forum_id' => $f, 134 ), 135 ) ); 136 $r1 = $this->factory->reply->create_many( 1, array( 137 'post_parent' => $t[0], 138 'reply_meta' => array( 139 'forum_id' => $f, 140 'topic_id' => $t[0], 141 ), 142 ) ); 143 $r2 = $this->factory->reply->create_many( 1, array( 137 144 'post_parent' => $t[1], 138 145 'reply_meta' => array( … … 141 148 ), 142 149 ) ); 143 $r2 = $this->factory->reply->create_many( 2, array(144 'post_parent' => $t[2],145 'reply_meta' => array(146 'forum_id' => $f,147 'topic_id' => $t[2],148 ),149 ) );150 150 151 151 $count = bbp_update_forum_topic_count( $f ); 152 $this->assertSame( 3, $count );152 $this->assertSame( 2, $count ); 153 153 154 154 $count = bbp_update_forum_topic_count_hidden( $f ); … … 156 156 157 157 $count = bbp_update_forum_reply_count( $f ); 158 $this->assertSame( 4, $count );159 160 bbp_spam_topic( $t[ 2] );161 162 $count = bbp_get_forum_topic_count( $f, true, true ); 163 $this->assertSame( 2, $count );164 165 $count = bbp_get_forum_topic_count_hidden( $f, true, true ); 166 $this->assertSame( 1, $count ); 167 168 $count = bbp_get_forum_reply_count( $f, true, true ); 169 $this->assertSame( 2, $count );170 171 bbp_unspam_topic( $t[ 2] );172 173 $count = bbp_get_forum_topic_count( $f, true, true ); 174 $this->assertSame( 3, $count );175 176 $count = bbp_get_forum_topic_count_hidden( $f, true, true ); 177 $this->assertSame( 0, $count ); 178 179 $count = bbp_get_forum_reply_count( $f, true, true ); 180 $this->assertSame( 4, $count );158 $this->assertSame( 2, $count ); 159 160 bbp_spam_topic( $t[1] ); 161 162 $count = bbp_get_forum_topic_count( $f, true, true ); 163 $this->assertSame( 1, $count ); 164 165 $count = bbp_get_forum_topic_count_hidden( $f, true, true ); 166 $this->assertSame( 1, $count ); 167 168 $count = bbp_get_forum_reply_count( $f, true, true ); 169 $this->assertSame( 1, $count ); 170 171 bbp_unspam_topic( $t[1] ); 172 173 $count = bbp_get_forum_topic_count( $f, true, true ); 174 $this->assertSame( 2, $count ); 175 176 $count = bbp_get_forum_topic_count_hidden( $f, true, true ); 177 $this->assertSame( 0, $count ); 178 179 $count = bbp_get_forum_reply_count( $f, true, true ); 180 $this->assertSame( 2, $count ); 181 181 } 182 182
Note: See TracChangeset
for help on using the changeset viewer.