Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/23/2022 02:21:19 AM (21 months ago)
Author:
imath
Message:

Make sure an activity is created when adding a site from network admin

When the Blogs component is active, creating a new public site from
front-end and now from the WordPress network administration is generating
a new_blog activity type.

Closes https://github.com/buddypress/buddypress/pull/28
Fixes #8756

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/activity/functions.php

    r13146 r13343  
    856856        }
    857857
    858         $b = self::factory()->blog->create();
    859         $u = self::factory()->user->create();
     858        $bp    = buddypress();
     859        $b     = self::factory()->blog->create();
     860        $u     = self::factory()->user->create();
     861        $reset = $bp->activity->track;
    860862
    861863        switch_to_blog( $b );
     864
     865        $bp->activity->track = array();
    862866
    863867        register_post_type( 'foo', array(
     
    884888
    885889        _unregister_post_type( 'foo' );
    886         bp_activity_get_actions();
    887 
    888890        restore_current_blog();
    889891
    890         $a = self::factory()->activity->create( $activity_args );
    891 
     892        $a     = self::factory()->activity->create( $activity_args );
    892893        $a_obj = new BP_Activity_Activity( $a );
    893894
     
    899900
    900901        $expected = sprintf( '%s wrote a new %s, on the site %s', $user_link, $post_link, '<a href="' . $blog_url . '">' . get_blog_option( $a_obj->item_id, 'blogname' ) . '</a>' );
     902        $bp->activity->track = $reset;
    901903
    902904        $this->assertSame( $expected, $a_obj->action );
     
    968970        }
    969971
    970         $b = self::factory()->blog->create();
    971         $u = self::factory()->user->create();
     972        $bp = buddypress();
     973        $b  = self::factory()->blog->create();
     974        $u  = self::factory()->user->create();
     975        $reset = $bp->activity->track;
    972976
    973977        switch_to_blog( $b );
     978
     979        $bp->activity->track = array();
    974980
    975981        $labels = array(
     
    10101016
    10111017        $user_link = bp_core_get_userlink( $u );
    1012         $blog_url = get_blog_option( $a_obj->item_id, 'home' );
    1013         $post_url = add_query_arg( 'p', $p, trailingslashit( $blog_url ) );
     1018        $blog_url  = get_blog_option( $a_obj->item_id, 'home' );
     1019        $post_url  = add_query_arg( 'p', $p, trailingslashit( $blog_url ) );
    10141020
    10151021        $expected = sprintf( '%1$s shared a new <a href="%2$s">bar</a>, on the site %3$s', $user_link, $post_url, '<a href="' . $blog_url . '">' . get_blog_option( $a_obj->item_id, 'blogname' ) . '</a>' );
     1022        $bp->activity->track = $reset;
    10161023
    10171024        $this->assertSame( $expected, $a_obj->action );
     
    10981105     */
    10991106    public function test_bp_activity_format_activity_action_custom_post_type_comment() {
     1107        $bp    = buddypress();
     1108        $reset = $bp->activity->track;
     1109
    11001110        if ( is_multisite() ) {
    11011111            $b = self::factory()->blog->create();
     1112
    11021113            switch_to_blog( $b );
     1114
     1115            $bp->activity->track = array();
    11031116            add_filter( 'comment_flood_filter', '__return_false' );
    11041117        } else {
     
    11601173
    11611174            $expected = sprintf( $labels['bp_activity_new_comment_ms'], $user_link, $comment_url, '<a href="' . $blog_url . '">' . get_blog_option( $a_obj->item_id, 'blogname' ) . '</a>' );
     1175
     1176            $bp->activity->track = $reset;
    11621177        } else {
    11631178            $expected = sprintf( $labels['bp_activity_new_comment'], $user_link, $comment_url );
Note: See TracChangeset for help on using the changeset viewer.