Changeset 5831 for trunk/tests/phpunit/testcases/admin/tools.php
- Timestamp:
- 07/14/2015 10:19:30 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/admin/tools.php
r5782 r5831 116 116 /** 117 117 * @covers ::bbp_admin_repair_topic_voice_count 118 * @todo Implement test_bbp_admin_repair_topic_voice_count().119 118 */ 120 119 public function test_bbp_admin_repair_topic_voice_count() { 121 // Remove the following lines when you implement this test. 122 $this->markTestIncomplete( 123 'This test has not been implemented yet.' 124 ); 120 $u = $this->factory->user->create_many( 2 ); 121 122 $f = $this->factory->forum->create(); 123 124 $t = $this->factory->topic->create( array( 125 'post_parent' => $f, 126 'topic_meta' => array( 127 'forum_id' => $f, 128 ), 129 ) ); 130 131 $r = $this->factory->reply->create( array( 132 'post_author' => $u[0], 133 'post_parent' => $t, 134 'reply_meta' => array( 135 'forum_id' => $f, 136 'topic_id' => $t, 137 ), 138 ) ); 139 140 $r = $this->factory->reply->create( array( 141 'post_author' => $u[1], 142 'post_parent' => $t, 143 'reply_meta' => array( 144 'forum_id' => $f, 145 'topic_id' => $t, 146 ), 147 ) ); 148 149 $count = bbp_get_topic_voice_count( $t ); 150 $this->assertSame( '3', $count ); 151 152 // Delete the topic _bbp_voice_count meta key. 153 $this->assertTrue( delete_post_meta_by_key( '_bbp_voice_count' ) ); 154 155 $count = bbp_get_topic_voice_count( $t ); 156 $this->assertSame( '0', $count ); 157 158 // Repair the topic voice count meta. 159 bbp_admin_repair_topic_voice_count(); 160 161 bbp_clean_post_cache( $t ); 162 163 $count = bbp_get_topic_voice_count( $t ); 164 $this->assertSame( '3', $count ); 125 165 } 126 166
Note: See TracChangeset
for help on using the changeset viewer.