Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/25/2023 05:18:41 PM (3 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/bpCoreRemoveNavItem.php

    r11256 r13507  
    66 */
    77class BP_Tests_Core_Nav_BpCoreRemoveNavItem extends BP_UnitTestCase {
    8     /**
    9      * @expectedIncorrectUsage bp_nav
    10      */
    11     public function test_should_remove_subnav_items() {
    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_nav['foo'] ) );
    32         $this->assertTrue( isset( $bp->bp_options_nav['foo'] ) );
    33         $this->assertTrue( isset( $bp->bp_options_nav['foo']['bar'] ) );
    34 
    35         bp_core_remove_nav_item( 'foo' );
    36 
    37         $this->assertFalse( isset( $bp->bp_options_nav['foo']['bar'] ) );
    38 
    39         $bp->bp_nav = $_bp_nav;
    40         $bp->bp_options_nav = $_bp_options_nav;
    41     }
    42 
    43     /**
    44      * @expectedIncorrectUsage bp_nav
    45      */
    46     public function test_should_remove_nav_item() {
    47         $bp = buddypress();
    48 
    49         $_bp_nav = $bp->bp_nav;
    50         $_bp_options_nav = $bp->bp_options_nav;
    51 
    52         bp_core_new_nav_item( array(
    53             'name' => 'Foo',
    54             'slug' => 'foo',
    55             'screen_function' => 'foo',
    56         ) );
    57 
    58         $this->assertTrue( isset( $bp->bp_nav['foo'] ) );
    59 
    60         bp_core_remove_nav_item( 'foo' );
    61 
    62         $this->assertFalse( isset( $bp->bp_nav['foo'] ) );
    63 
    64         $bp->bp_nav = $_bp_nav;
    65         $bp->bp_options_nav = $_bp_options_nav;
    66     }
    67 
    688    /**
    699     * @ticket BP7203
Note: See TracChangeset for help on using the changeset viewer.