Changeset 5780
- Timestamp:
- 05/22/2015 10:37:26 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/topics/functions/counts.php
r5769 r5780 61 61 ) ); 62 62 63 // Start with zero 63 64 $count = bbp_get_topic_reply_count( $t ); 64 65 $this->assertSame( '0', $count ); … … 73 74 ) ); 74 75 75 // @todo Investigate caching issues in bbp_get_public_child_count()76 wp_cache_flush();76 $count = bbp_get_topic_reply_count( $t ); 77 $this->assertSame( '3', $count ); 77 78 78 79 bbp_update_topic_reply_count( $t ); 79 80 // @todo Investigate caching issues in bbp_get_public_child_count()81 wp_cache_flush();82 80 83 81 $count = bbp_get_topic_reply_count( $t ); … … 95 93 // Test update using reply id 96 94 bbp_update_topic_reply_count( $r2 ); 97 98 95 $count = bbp_get_topic_reply_count( $t ); 99 96 $this->assertSame( '4', $count ); 97 98 // Spam a reply 99 bbp_spam_reply( $r2 ); 100 101 bbp_update_topic_reply_count( $t ); 102 $count = bbp_get_topic_reply_count( $t ); 103 $this->assertSame( '3', $count ); 104 105 // Set the reply count manually 106 bbp_update_topic_reply_count( $t, 7 ); 107 $count = bbp_get_topic_reply_count( $t ); 108 $this->assertSame( '7', $count ); 100 109 } 101 110 … … 104 113 */ 105 114 public function test_bbp_update_topic_reply_count_hidden() { 106 $t = $this->factory->topic->create(); 115 // Create a forum 116 $f = $this->factory->forum->create(); 107 117 118 // Create a topic 119 $t = $this->factory->topic->create( array( 120 'post_parent' => $f, 121 'topic_meta' => array( 122 'forum_id' => $f, 123 ) 124 ) ); 125 126 // Start with zero 108 127 $count = bbp_get_topic_reply_count_hidden( $t ); 109 128 $this->assertSame( '0', $count ); 110 129 111 $r = $this->factory->reply->create_many( 15, array(130 $r = $this->factory->reply->create_many( 3, array( 112 131 'post_parent' => $t, 132 'reply_meta' => array( 133 'forum_id' => $f, 134 'topic_id' => $t, 135 ) 113 136 ) ); 114 137 115 138 bbp_update_topic_reply_count_hidden( $t ); 116 117 139 $count = bbp_get_topic_reply_count_hidden( $t ); 118 140 $this->assertSame( '0', $count ); 119 141 120 bbp_spam_reply( $r[ 11] );142 bbp_spam_reply( $r[2] ); 121 143 122 144 bbp_update_topic_reply_count_hidden( $t ); 123 124 145 $count = bbp_get_topic_reply_count_hidden( $t ); 125 146 $this->assertSame( '1', $count ); 126 147 127 bbp_unapprove_reply( $r[ 7] );148 bbp_unapprove_reply( $r[0] ); 128 149 129 150 bbp_update_topic_reply_count_hidden( $t ); 130 131 151 $count = bbp_get_topic_reply_count_hidden( $t ); 132 152 $this->assertSame( '2', $count ); … … 149 169 150 170 bbp_update_topic_voice_count( $t ); 151 152 171 $count = bbp_get_topic_voice_count( $t ); 153 172 $this->assertSame( '2', $count ); 173 174 $count = bbp_update_topic_voice_count( $t ); 175 $this->assertSame( 2, $count ); 154 176 155 177 $r = $this->factory->reply->create( array( … … 159 181 160 182 bbp_update_topic_voice_count( $t ); 161 162 183 $count = bbp_get_topic_voice_count( $t ); 163 184 $this->assertSame( '3', $count );
Note: See TracChangeset
for help on using the changeset viewer.