[buddypress-trac] [BuddyPress] #4948: bp_core_avatar_url() wonky in sub-sites since WP 3.5

buddypress-trac noreply at wordpress.org
Sat Apr 27 03:07:13 UTC 2013


#4948: bp_core_avatar_url() wonky in sub-sites since WP 3.5
----------------------------------------+--------------------
 Reporter:  r-a-y                       |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  1.7.1
Component:  Core                        |     Version:  1.6.4
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |
----------------------------------------+--------------------

Comment (by r-a-y):

 > Is it possible to write tests for it?

 I tried writing a unit test for this, but a few things are iffy.

 1) BP (and WP core) unit tests don't properly emulate a page load for
 multisite.  I've added some code to somewhat address this in our `go_to()`
 method.  (See `unittests.patch`)

 2) The other problem is BP avatar's reliance on constants like
 `BP_AVATAR_URL` and `BP_AVATAR_UPLOAD_PATH` as a fallback.

 The `go_to()` method usually tries to wipe out global variables to start
 clean and this works for the most part, but you can't wipe out defines.

 By the time BP loads up in PHPUnit, the defines are already set.

 This causes a problem when trying to use the `go_to()` method with a sub-
 site URL because `bp_core_avatar_url()` will just use the define instead
 of trying to get to the next conditional like a normal new page load
 would.

 * Unit test will stop here -
 https://buddypress.trac.wordpress.org/browser/tags/1.7/bp-core/bp-core-
 avatars.php#L847
 * And never gets a chance to parse this in multisite -
 https://buddypress.trac.wordpress.org/browser/tags/1.7/bp-core/bp-core-
 avatars.php#L865

 This gives the illusion that the unit test will pass, but in reality, it
 should not.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4948#comment:5>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list