[buddypress-trac] [BuddyPress Trac] #5965: test suite doesn't reset globals if go_to() is used twice in one test

buddypress-trac noreply at wordpress.org
Mon Oct 27 05:59:21 UTC 2014


#5965: test suite doesn't reset globals if go_to() is used twice in one test
--------------------------+------------------
 Reporter:  DJPaul        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  2.2
Component:  Unit Tests    |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------

Comment (by DJPaul):

 We already override `go_to` in our test suite so I'm going to add in a
 call to `clean_up_global_scope` .

 Writing tests to test our test suite seems a bit meta, but you can demo
 the bug like this:

 {{{
 //bug
 $this->go_to( bp_get_activity_directory_permalink() );
 $this->go_to( bp_get_root_domain() . '/' . strtoupper(
 bp_get_activity_root_slug() ) . '/' );
 die(var_dump( buddypress()->current_component ));  // returns "activity"
 }}}

 vs.

 {{{
 //desired behaviour (this reveals a bug in the router code, but that's
 another issue).
 $this->go_to( bp_get_activity_directory_permalink() );
 $this->go_to( bp_get_root_domain() . '/' . strtoupper(
 bp_get_activity_root_slug() ) . '/' );
 die(var_dump( buddypress()->current_component ));  // returns "" (empty
 string)
 }}}

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5965#comment:1>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list