[buddypress-trac] [BuddyPress Trac] #5420: unit tests failing because of using bp_group_has_members() outside group context
buddypress-trac
noreply at wordpress.org
Sun Feb 23 22:16:05 UTC 2014
#5420: unit tests failing because of using bp_group_has_members() outside group
context
--------------------------+-----------------------------
Reporter: DJPaul | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Unit Tests | Version:
Severity: normal | Keywords:
--------------------------+-----------------------------
I've been getting a few unit test failures locally from trunk recently,
though travis-ci has been passing fine. I fixed some missing variable
problems in r7972 the other night but have multiple failures in group-
related tests. They all fail for the same BP functions; sample output for
one is included below, and you can see everything at
https://gist.github.com/paulgibbs/ea67e423c8c37063845a.
{{{
1) BP_Tests_Groups_Template::test_bp_group_has_members_vanilla
Trying to get property of non-object
/Users/paul/Sites/example.com/src/wp-content/plugins/buddypress/bp-groups
/bp-groups-template.php:575
/Users/paul/Sites/example.com/src/wp-content/plugins/buddypress/bp-groups
/bp-groups-template.php:2032
/Users/paul/Sites/example.com/src/wp-content/plugins/buddypress/bp-groups
/bp-groups-template.php:2163
/Users/paul/Sites/example.com/src/wp-
content/plugins/buddypress/tests/testcases/groups/template.php:115
}}}
This test uses `bp_group_has_members()` which uses the
`BP_Groups_Group_Members_Template` class. This class in its constructor
method uses `groups_get_current_group()`, which uses
`$bp->groups->current_group`. This property is primarily set in the
Group's `setup_globals()` method when we're viewing a single group. This
unit test, of course, doesn't use `go_to`, so this property is never set.
I have checked with a couple of other people and I am not sure why I am
seeing these failed tests and no-one else is. For further investigation
and review, the attached patch fixes the issue for me.
I am running PHP 5.4.19 with no caching module and no object caching.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5420>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list