- Timestamp:
- 05/23/2015 08:35:11 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/forums/functions/counts.php
r5777 r5792 61 61 $f1 = $this->factory->forum->create(); 62 62 63 $f2 = $this->factory->forum->create_many( 9, array( 64 'post_parent' => $f1, 65 ) ); 66 67 $count = bbp_get_forum_subforum_count( $f1, $integer = true ); 68 $this->assertSame( 0, $count ); 69 70 $count = count( bbp_forum_query_subforum_ids( $f1 ) ); 71 $this->assertSame( 9, $count ); 63 $f2 = $this->factory->forum->create_many( 3, array( 64 'post_parent' => $f1, 65 ) ); 66 67 $count = bbp_get_forum_subforum_count( $f1, true ); 68 $this->assertSame( 0, $count ); 72 69 73 70 bbp_update_forum_subforum_count( $f1 ); 74 71 75 $count = bbp_get_forum_subforum_count( $f1, $integer = true ); 76 $this->assertSame( 9, $count ); 77 78 $count = count( bbp_forum_query_subforum_ids( $f1 ) ); 79 $this->assertSame( 9, $count ); 72 $count = bbp_get_forum_subforum_count( $f1, true ); 73 $this->assertSame( 3, $count ); 80 74 } 81 75 … … 168 162 $f = $this->factory->forum->create(); 169 163 170 $count = bbp_get_forum_topic_count( $f );171 $this->assertSame( '0', $count );172 173 $t = $this->factory->topic->create_many( 15, array(164 $count = bbp_get_forum_topic_count( $f, false, true ); 165 $this->assertSame( 0, $count ); 166 167 $t = $this->factory->topic->create_many( 3, array( 174 168 'post_parent' => $f, 169 'topic_meta' => array( 170 'forum_id' => $f, 171 ), 175 172 ) ); 176 173 177 174 bbp_update_forum_topic_count_hidden( $f ); 178 175 179 $count = bbp_get_forum_topic_count_hidden( $f );180 $this->assertSame( '0', $count );;181 182 bbp_spam_topic( $t[ 11] );176 $count = bbp_get_forum_topic_count_hidden( $f, true ); 177 $this->assertSame( 0, $count );; 178 179 bbp_spam_topic( $t[2] ); 183 180 184 181 bbp_update_forum_topic_count_hidden( $f ); 185 182 186 $count = bbp_get_forum_topic_count_hidden( $f );187 $this->assertSame( '1', $count );;188 189 bbp_unapprove_topic( $t[ 7] );183 $count = bbp_get_forum_topic_count_hidden( $f, true ); 184 $this->assertSame( 1, $count );; 185 186 bbp_unapprove_topic( $t[0] ); 190 187 191 188 bbp_update_forum_topic_count_hidden( $f ); 192 189 193 $count = bbp_get_forum_topic_count_hidden( $f );194 $this->assertSame( '2', $count );190 $count = bbp_get_forum_topic_count_hidden( $f, true ); 191 $this->assertSame( 2, $count ); 195 192 } 196 193 … … 199 196 */ 200 197 public function test_bbp_update_forum_reply_count() { 201 $f = $this->factory->forum->create(); 202 203 $count = bbp_get_forum_reply_count( $f ); 204 $this->assertSame( '0', $count ); 205 206 $t = $this->factory->topic->create( array( 207 'post_parent' => $f, 208 ) ); 209 210 bbp_update_forum_reply_count( $f ); 211 212 $count = bbp_get_forum_reply_count( $f ); 213 $this->assertSame( '0', $count ); 214 215 $r = $this->factory->reply->create_many( 15, array( 216 'post_parent' => $t, 217 ) ); 218 219 bbp_update_forum_reply_count( $f ); 220 221 $count = bbp_get_forum_reply_count( $f ); 222 $this->assertSame( '15', $count ); 198 $f1 = $this->factory->forum->create(); 199 200 $f2 = $this->factory->forum->create( array( 201 'post_parent' => $f1, 202 ) ); 203 204 $t1 = $this->factory->topic->create( array( 205 'post_parent' => $f1, 206 'topic_meta' => array( 207 'forum_id' => $f1, 208 ), 209 ) ); 210 211 $t2 = $this->factory->topic->create( array( 212 'post_parent' => $f2, 213 'topic_meta' => array( 214 'forum_id' => $f2, 215 ), 216 ) ); 217 218 $count = bbp_get_forum_reply_count( $f1, false, true ); 219 $this->assertSame( 0, $count ); 220 221 $count = bbp_update_forum_reply_count( $f1 ); 222 $this->assertSame( 0, $count ); 223 224 $this->factory->reply->create_many( 3, array( 225 'post_parent' => $t1, 226 'reply_meta' => array( 227 'forum_id' => $f1, 228 'topic_id' => $t1, 229 ), 230 ) ); 231 232 $count = bbp_update_forum_reply_count( $f1 ); 233 $this->assertSame( 3, $count ); 234 235 $this->factory->reply->create_many( 3, array( 236 'post_parent' => $t2, 237 'reply_meta' => array( 238 'forum_id' => $f2, 239 'topic_id' => $t2, 240 ), 241 ) ); 242 243 $count = bbp_update_forum_reply_count( $f1 ); 244 $this->assertSame( 6, $count ); 245 246 $count = bbp_update_forum_reply_count( $f2 ); 247 $this->assertSame( 3, $count ); 223 248 } 224 249 }
Note: See TracChangeset
for help on using the changeset viewer.