Skip to:
Content

BuddyPress.org

Ticket #7703: 7703.01.patch

File 7703.01.patch, 4.1 KB (added by r-a-y, 7 years ago)
  • src/bp-core/bp-core-functions.php

    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 ) { 
    10361036        // conflicts with wp_redirect() and wp_safe_redirect().
    10371037        buddypress()->no_status_set = true;
    10381038
    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        }
    10411044}
    10421045
    10431046/**
  • tests/phpunit/includes/testcase.php

    diff --git tests/phpunit/includes/testcase.php tests/phpunit/includes/testcase.php
    index 3b1e4755..c57e7986 100644
    class BP_UnitTestCase extends WP_UnitTestCase { 
    193193                parent::go_to( $url );
    194194
    195195                do_action( 'bp_init' );
     196                do_action( 'bp_template_redirect' );
    196197        }
    197198
    198199        /**
  • tests/phpunit/testcases/activity/notifications.php

    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 { 
    5050                $this->assertEquals( array( $this->a1 ), wp_list_pluck( $notifications, 'item_id' ) );
    5151
    5252                // 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 );
    5654
    5755                $notifications = BP_Notifications_Notification::get( array(
    5856                        'user_id' => $this->u1,
    class BP_Tests_Activity_Notifications extends BP_UnitTestCase { 
    8078                $this->set_current_user( 0 );
    8179
    8280                // 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 );
    8682
    8783                $notifications = BP_Notifications_Notification::get( array(
    8884                        'user_id' => $this->u1,
    class BP_Tests_Activity_Notifications extends BP_UnitTestCase { 
    112108                $this->set_current_user( $this->u2 );
    113109
    114110                // 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 );
    118112
    119113                $notifications = BP_Notifications_Notification::get( array(
    120114                        'user_id' => $this->u1,
    class BP_Tests_Activity_Notifications extends BP_UnitTestCase { 
    142136
    143137                // Go to the My Activity page
    144138                $this->go_to( bp_core_get_user_domain( $this->u1 ) . bp_get_activity_slug() . '/mentions/' );
    145                 do_action( 'bp_activity_screen_mentions' );
    146139
    147140                $notifications = BP_Notifications_Notification::get( array(
    148141                        'user_id' => $this->u1,
    class BP_Tests_Activity_Notifications extends BP_UnitTestCase { 
    171164
    172165                // Go to the My Activity page
    173166                $this->go_to( bp_core_get_user_domain( $this->u1 ) . bp_get_activity_slug() . '/mentions/' );
    174                 do_action( 'bp_activity_screen_mentions' );
    175167
    176168                $notifications = BP_Notifications_Notification::get( array(
    177169                        'user_id' => $this->u1,
    class BP_Tests_Activity_Notifications extends BP_UnitTestCase { 
    203195
    204196                // Go to the My Activity page
    205197                $this->go_to( bp_core_get_user_domain( $this->u1 ) . bp_get_activity_slug() . '/mentions/' );
    206                 do_action( 'bp_activity_screen_mentions' );
    207198
    208199                $notifications = BP_Notifications_Notification::get( array(
    209200                        'user_id' => $this->u1,