[buddypress-trac] [BuddyPress Trac] #5858: blog directory search returns incorrect result count

buddypress-trac noreply at wordpress.org
Tue Jan 6 20:08:37 UTC 2015

#5858: blog directory search returns incorrect result count
 Reporter:  jreeve                          |       Owner:
     Type:  defect (bug)                    |      Status:  new
 Priority:  normal                          |   Milestone:  Future Release
Component:  Blogs                           |     Version:  1.2
 Severity:  normal                          |  Resolution:
 Keywords:  needs-refresh needs-unit-tests  |

Comment (by jreeve):

 I tested this patch with the Buddypress PHPUnit tests, and all went OK:

 OK, but incomplete or skipped tests!
 Tests: 795, Assertions: 1342, Skipped: 5.

 But by `needs-unit-tests` I'm guessing that means a unit test designed for
 this feature? I imagine that would be something like this:

 public function test_get_totals_with_search_terms() {
                 if ( ! is_multisite() ) {

                 $old_user = get_current_user_id();

                 $u = $this->factory->user->create();
                 $this->set_current_user( $u );
                 $b = $this->factory->blog->create( array(
                         'title' => 'The Foo Bar Blog',
                         'description' => 'This blog mentions apples..',
                         'user_id' => $u,
                 ) );

                 // make the blog public or it won't turn up in generic
                 update_blog_option( $b, 'blog_public', '1' );

                 $blogs = BP_Blogs_Blog::get( 'active', false, false, 0,
 'apples' );
                 $blog_ids = wp_list_pluck( $blogs['blogs'], 'blog_id' );

                 $this->assertEquals( count( $blogs['blogs'] ),
 $blogs['total'] );

                 $this->set_current_user( $old_user );

 But I have very little experience writing tests, and so something's
 failing here that I don't understand, and I'm not quite sure how to debug
 it. But hopefully this is a step in the right direction!

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5858#comment:4>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list