[buddypress-trac] [BuddyPress Trac] #5477: Allow bp_has_groups to return all groups
buddypress-trac
noreply at wordpress.org
Wed Aug 13 02:17:01 UTC 2014
#5477: Allow bp_has_groups to return all groups
-------------------------------------------------+-------------------------
Reporter: dcavins | Owner: dcavins
Type: enhancement | Status: assigned
Priority: normal | Milestone: 2.2
Component: Groups | Version:
Severity: minor | Resolution:
Keywords: has-patch needs-unit-tests dev- |
feedback |
-------------------------------------------------+-------------------------
Comment (by dcavins):
Replying to [comment:7 boonebgorges]:
> Testing `BP_Groups_Group::get()` is good - the lower down the stack the
better.
>
> The basic logic of the test looks good. The one thing I'd say is that
the no-pagination tests don't really show much, since you'd get the same
results with the default pagination args (per_page=20,page=1). It's
annoying, but I think that to test this you need to create more than 20
groups. To save CPU overhead, do it in a single test and run multiple
assertions on it. And no need to bother with the varying timestamps, since
you're just checking counts (and thus don't care about the order). So:
>
> {{{
> $group_ids = array();
> for ( $i = 1; $i <= 25; $i++ ) {
> $group_ids[] = $this->factory->group->create();
> }
> }}}
>
> Then go ahead and run all of your three different pagination assertions
in the same test, on the same data.
Thanks for the feedback. I was thinking of 20 as the magic number, too,
although it's really only the magic number in `groups_get_groups()` or the
`bp_has_groups()`, since `BP_Groups_Group::get()` doesn't try to set a
default. I'll update the tests and submit a new patch.
So it's OK to lump some tests together, if they basically test the same
parameters? (I'm thinking more of code style than functionality.) Thanks
again for the feedback.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5477#comment:8>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list