Skip to:
Content

BuddyPress.org

Changeset 10412


Ignore:
Timestamp:
12/17/2015 08:47:19 PM (6 years ago)
Author:
imath
Message:

Fix a typo in the bp_activity_set_post_type_tracking_args() function

Add a unit test to check activity tracking arguments are added the same way to the post type when setting them within register_post_type() or using the bp_activity_set_post_type_tracking_args()

Props danbrellis

Fixes #6777

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-functions.php

    r10375 r10412  
    423423        if ( ! empty( $args[ $label_type ] ) ) {
    424424            $wp_post_types[ $post_type ]->labels->{$label_type} = $args[ $label_type ];
    425             unset( $args[ $post_type ] );
     425            unset( $args[ $label_type ] );
    426426        }
    427427    }
  • trunk/tests/phpunit/testcases/activity/functions.php

    r9819 r10412  
    10861086        unset( $bp->activity->actions->blogs->new_page );
    10871087        $bp->activity->track = array();
     1088    }
     1089
     1090    /**
     1091     * @group bp_activity_set_post_type_tracking_args
     1092     * @group activity_tracking
     1093     */
     1094    public function test_bp_activity_set_post_type_tracking_args_check_post_type_global() {
     1095        $labels = array(
     1096            'bp_activity_admin_filter' => 'New Foo',
     1097            'bp_activity_front_filter' => 'Foos',
     1098        );
     1099
     1100        $bp_activity_args = array(
     1101            'action_id'    => 'new_foo',
     1102            'contexts'     => array( 'activity' ),
     1103            'position'     => 40,
     1104        );
     1105
     1106        register_post_type( 'foo', array(
     1107            'labels'      => $labels,
     1108            'supports'    => array( 'buddypress-activity' ),
     1109            'bp_activity' => $bp_activity_args
     1110        ) );
     1111
     1112        $register_bp_activity = get_post_type_object( 'foo' )->bp_activity;
     1113        _unregister_post_type( 'foo' );
     1114
     1115        register_post_type( 'foo', array(
     1116            'label'       => 'foo',
     1117            'supports'    => array( 'buddypress-activity' ),
     1118        ) );
     1119
     1120        bp_activity_set_post_type_tracking_args( 'foo', $labels + $bp_activity_args );
     1121
     1122        $set_bp_activity = get_post_type_object( 'foo' )->bp_activity;
     1123        _unregister_post_type( 'foo' );
     1124
     1125        $this->assertSame( $set_bp_activity, $register_bp_activity );
    10881126    }
    10891127
Note: See TracChangeset for help on using the changeset viewer.