diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php
index ddef982d..cbc281e0 100644
|
|
function bp_core_redirect( $location = '', $status = 302 ) { |
1036 | 1036 | // conflicts with wp_redirect() and wp_safe_redirect(). |
1037 | 1037 | buddypress()->no_status_set = true; |
1038 | 1038 | |
1039 | | wp_safe_redirect( $location, $status ); |
1040 | | die; |
| 1039 | // Only redirect if PHPUnit isn't running. |
| 1040 | if ( ! defined( 'BP_TESTS_DIR' ) ) { |
| 1041 | wp_safe_redirect( $location, $status ); |
| 1042 | die; |
| 1043 | } |
1041 | 1044 | } |
1042 | 1045 | |
1043 | 1046 | /** |
diff --git tests/phpunit/includes/testcase.php tests/phpunit/includes/testcase.php
index 3b1e4755..c57e7986 100644
|
|
class BP_UnitTestCase extends WP_UnitTestCase { |
193 | 193 | parent::go_to( $url ); |
194 | 194 | |
195 | 195 | do_action( 'bp_init' ); |
| 196 | do_action( 'bp_template_redirect' ); |
196 | 197 | } |
197 | 198 | |
198 | 199 | /** |
diff --git tests/phpunit/testcases/activity/notifications.php tests/phpunit/testcases/activity/notifications.php
index 86bd02c1..8aa41df2 100644
|
|
class BP_Tests_Activity_Notifications extends BP_UnitTestCase { |
50 | 50 | $this->assertEquals( array( $this->a1 ), wp_list_pluck( $notifications, 'item_id' ) ); |
51 | 51 | |
52 | 52 | // Go to the activity permalink page |
53 | | $this->go_to( bp_activity_get_permalink( $this->a1 ) ); |
54 | | $activity = bp_activity_get_specific( array( 'activity_ids' => $this->a1, 'show_hidden' => true, 'spam' => 'ham_only', ) ); |
55 | | do_action( 'bp_activity_screen_single_activity_permalink', $activity['activities'][0] ); |
| 53 | $this->go_to( bp_core_get_user_domain( $this->u1 ) . 'activity/' . $this->a1 ); |
56 | 54 | |
57 | 55 | $notifications = BP_Notifications_Notification::get( array( |
58 | 56 | 'user_id' => $this->u1, |
… |
… |
class BP_Tests_Activity_Notifications extends BP_UnitTestCase { |
80 | 78 | $this->set_current_user( 0 ); |
81 | 79 | |
82 | 80 | // Go to the activity permalink page |
83 | | $this->go_to( bp_activity_get_permalink( $this->a1 ) ); |
84 | | $activity = bp_activity_get_specific( array( 'activity_ids' => $this->a1, 'show_hidden' => true, 'spam' => 'ham_only', ) ); |
85 | | do_action( 'bp_activity_screen_single_activity_permalink', $activity['activities'][0] ); |
| 81 | $this->go_to( bp_core_get_user_domain( $this->u1 ) . 'activity/' . $this->a1 ); |
86 | 82 | |
87 | 83 | $notifications = BP_Notifications_Notification::get( array( |
88 | 84 | 'user_id' => $this->u1, |
… |
… |
class BP_Tests_Activity_Notifications extends BP_UnitTestCase { |
112 | 108 | $this->set_current_user( $this->u2 ); |
113 | 109 | |
114 | 110 | // Go to the activity permalink page |
115 | | $this->go_to( bp_activity_get_permalink( $this->a1 ) ); |
116 | | $activity = bp_activity_get_specific( array( 'activity_ids' => $this->a1, 'show_hidden' => true, 'spam' => 'ham_only', ) ); |
117 | | do_action( 'bp_activity_screen_single_activity_permalink', $activity['activities'][0] ); |
| 111 | $this->go_to( bp_core_get_user_domain( $this->u1 ) . 'activity/' . $this->a1 ); |
118 | 112 | |
119 | 113 | $notifications = BP_Notifications_Notification::get( array( |
120 | 114 | 'user_id' => $this->u1, |
… |
… |
class BP_Tests_Activity_Notifications extends BP_UnitTestCase { |
142 | 136 | |
143 | 137 | // Go to the My Activity page |
144 | 138 | $this->go_to( bp_core_get_user_domain( $this->u1 ) . bp_get_activity_slug() . '/mentions/' ); |
145 | | do_action( 'bp_activity_screen_mentions' ); |
146 | 139 | |
147 | 140 | $notifications = BP_Notifications_Notification::get( array( |
148 | 141 | 'user_id' => $this->u1, |
… |
… |
class BP_Tests_Activity_Notifications extends BP_UnitTestCase { |
171 | 164 | |
172 | 165 | // Go to the My Activity page |
173 | 166 | $this->go_to( bp_core_get_user_domain( $this->u1 ) . bp_get_activity_slug() . '/mentions/' ); |
174 | | do_action( 'bp_activity_screen_mentions' ); |
175 | 167 | |
176 | 168 | $notifications = BP_Notifications_Notification::get( array( |
177 | 169 | 'user_id' => $this->u1, |
… |
… |
class BP_Tests_Activity_Notifications extends BP_UnitTestCase { |
203 | 195 | |
204 | 196 | // Go to the My Activity page |
205 | 197 | $this->go_to( bp_core_get_user_domain( $this->u1 ) . bp_get_activity_slug() . '/mentions/' ); |
206 | | do_action( 'bp_activity_screen_mentions' ); |
207 | 198 | |
208 | 199 | $notifications = BP_Notifications_Notification::get( array( |
209 | 200 | 'user_id' => $this->u1, |