Changeset 7787
- Timestamp:
- 10/04/2026 08:20:08 AM (5 weeks ago)
- Location:
- trunk/tests/phpunit/testcases
- Files:
-
- 2 edited
-
common/query.php (modified) (1 diff)
-
topics/functions/counts.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/common/query.php
r6849 r7787 10 10 class BBP_Tests_Common_Functions_Query extends BBP_UnitTestCase { 11 11 12 /**12 /** 13 13 * @covers ::bbp_query_post_parent__in 14 * @todo Implement test_bbp_query_post_parent__in().15 14 */ 16 15 public function test_bbp_query_post_parent__in() { 17 // Remove the following lines when you implement this test. 18 $this->markTestIncomplete( 19 'This test has not been implemented yet.' 20 ); 16 global $wp; 17 18 $old_query_vars = $wp->private_query_vars; 19 $wp->private_query_vars = array_diff( $old_query_vars, array( 'post_parent__in' ) ); 20 $query = (object) array( 'query_vars' => array( 'post_parent' => '', 'post_parent__in' => array( '12', '34' ), 'post_parent__not_in' => array() ) ); 21 22 try { 23 $this->assertSame( 'base', bbp_query_post_parent__in( 'base' ) ); 24 $this->assertSame( 'base AND ' . bbp_db()->posts . '.post_parent IN (12,34)', bbp_query_post_parent__in( 'base', $query ) ); 25 26 $query->query_vars['post_parent__in'] = array(); 27 $query->query_vars['post_parent__not_in'] = array( '56', '78' ); 28 $this->assertSame( 'base AND ' . bbp_db()->posts . '.post_parent NOT IN (56,78)', bbp_query_post_parent__in( 'base', $query ) ); 29 30 $query->query_vars['post_parent'] = 12; 31 $this->assertSame( 'base', bbp_query_post_parent__in( 'base', $query ) ); 32 33 $wp->private_query_vars = $old_query_vars; 34 $wp->private_query_vars[] = 'post_parent__in'; 35 $query->query_vars['post_parent'] = ''; 36 $this->assertSame( 'base', bbp_query_post_parent__in( 'base', $query ) ); 37 } finally { 38 $wp->private_query_vars = $old_query_vars; 39 } 21 40 } 22 41 -
trunk/tests/phpunit/testcases/topics/functions/counts.php
r7467 r7787 695 695 /** 696 696 * @covers ::bbp_update_topic_anonymous_reply_count 697 * @todo Implement test_bbp_update_topic_anonymous_reply_count().698 697 */ 699 698 public function test_bbp_update_topic_anonymous_reply_count() { 700 // Remove the following lines when you implement this test. 701 $this->markTestIncomplete( 702 'This test has not been implemented yet.' 703 ); 699 $user_id = $this->factory->user->create(); 700 $forum_id = $this->factory->forum->create(); 701 $topic_id = $this->factory->topic->create( array( 'post_parent' => $forum_id, 'post_author' => $user_id ) ); 702 $reply_id = $this->factory->reply->create( array( 'post_parent' => $topic_id, 'post_author' => 0 ) ); 703 $this->factory->reply->create( array( 'post_parent' => $topic_id, 'post_author' => $user_id ) ); 704 $this->factory->reply->create( array( 'post_parent' => $topic_id, 'post_author' => 0, 'post_status' => bbp_get_spam_status_id() ) ); 705 706 $this->assertSame( 1, bbp_update_topic_anonymous_reply_count( $topic_id ) ); 707 $this->assertSame( '1', get_post_meta( $topic_id, '_bbp_anonymous_reply_count', true ) ); 708 $this->assertSame( 1, bbp_update_topic_anonymous_reply_count( $reply_id ) ); 709 710 wp_update_post( array( 'ID' => $topic_id, 'post_author' => 0 ) ); 711 $this->assertSame( 2, bbp_update_topic_anonymous_reply_count( $topic_id ) ); 712 $this->assertSame( '2', get_post_meta( $topic_id, '_bbp_anonymous_reply_count', true ) ); 704 713 } 705 714 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)