[buddypress-trac] [BuddyPress Trac] #7703: Unit tests: Run `'bp_template_redirect'` hook in `go_to()` method

buddypress-trac noreply at wordpress.org
Sun Mar 4 21:35:47 UTC 2018


#7703: Unit tests: Run `'bp_template_redirect'` hook in `go_to()` method
------------------------------+---------------------
 Reporter:  r-a-y             |       Owner:  r-a-y
     Type:  defect (bug)      |      Status:  closed
 Priority:  normal            |   Milestone:  3.0
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:  fixed
 Keywords:  has-patch commit  |
------------------------------+---------------------
Changes (by r-a-y):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"11882"]:
 {{{
 #!CommitTicketReference repository="" revision="11882"
 Unit Tests: Run `'bp_template_redirect'` hook in `go_to()` method.

 In PHPUnit, we mock page visits with the `go_to()` method, however we
 previously only ran the `'bp_init'` hook, which sets up various internal
 page routing properties, but doesn't run any screen hooks.

 This commit adds the `'bp_template_redirect'` hook to the `go_to()`
 method,
 which allows hooks like `'bp_actions'` and `'bp_screens'` to run.  In
 order
 for those hooks to run without errors in PHPUnit, we need to adjust our
 `bp_core_redirect()` function so it doesn't kill execution.  Also, for
 PHPUnit, we do not allow redirects to occur since they cause 'headers
 already sent' notices.

 Lastly, we can adjust some unit tests to just use the `go_to()` method,
 instead of needing to manually call a screen hook.

 Fixes #7703.
 }}}

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


More information about the buddypress-trac mailing list