Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/25/2023 05:18:41 PM (2 years ago)
Author:
imath
Message:

Fully deprecate bp_nav & bp_options_nav BP globals

These back compatibility mechanism, which was in BP since version 2.6, has moved to the BP Classic plugin.

Fixes #8927
Closes https://github.com/buddypress/buddypress/pull/121

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/core/nav/bpCoreRemoveSubnavItem.php

    r13437 r13507  
    66 */
    77class BP_Tests_Core_Nav_BpCoreRemoveSubnavItem extends BP_UnitTestCase {
    8     /**
    9      * @expectedIncorrectUsage bp_nav
    10      */
    11     public function test_should_remove_subnav_item() {
    12         $bp = buddypress();
    13 
    14         $_bp_nav = $bp->bp_nav;
    15         $_bp_options_nav = $bp->bp_options_nav;
    16 
    17         bp_core_new_nav_item( array(
    18             'name' => 'Foo',
    19             'slug' => 'foo',
    20             'screen_function' => 'foo',
    21         ) );
    22 
    23         bp_core_new_subnav_item( array(
    24             'name' => 'Bar',
    25             'slug' => 'bar',
    26             'parent_slug' => 'foo',
    27             'parent_url' => 'foo',
    28             'screen_function' => 'bar',
    29         ) );
    30 
    31         $this->assertTrue( isset( $bp->bp_options_nav['foo']['bar'] ) );
    32 
    33         bp_core_remove_subnav_item( 'foo', 'bar' );
    34 
    35         $this->assertFalse( isset( $bp->bp_options_nav['foo']['bar'] ) );
    36 
    37         $bp->bp_nav = $_bp_nav;
    38         $bp->bp_options_nav = $_bp_options_nav;
    39     }
    40 
    41     /**
    42      * @expectedIncorrectUsage bp_nav
    43      */
    44     public function test_should_fail_on_incorrect_parent() {
    45         $bp = buddypress();
    46 
    47         $_bp_nav = $bp->bp_nav;
    48         $_bp_options_nav = $bp->bp_options_nav;
    49 
    50         bp_core_new_nav_item( array(
    51             'name' => 'Foo',
    52             'slug' => 'foo',
    53             'screen_function' => 'foo',
    54         ) );
    55 
    56         bp_core_new_subnav_item( array(
    57             'name' => 'Bar',
    58             'slug' => 'bar',
    59             'parent_slug' => 'foo',
    60             'parent_url' => 'foo',
    61             'screen_function' => 'bar',
    62         ) );
    63 
    64         $this->assertTrue( isset( $bp->bp_options_nav['foo']['bar'] ) );
    65 
    66         bp_core_remove_subnav_item( 'bad-parent', 'bar' );
    67 
    68         $this->assertTrue( isset( $bp->bp_options_nav['foo']['bar'] ) );
    69 
    70         $bp->bp_nav = $_bp_nav;
    71         $bp->bp_options_nav = $_bp_options_nav;
    72     }
    738
    749    public function test_backcompat_remove_group_nav_items() {
Note: See TracChangeset for help on using the changeset viewer.