Skip to:
Content

BuddyPress.org

Changeset 9991


Ignore:
Timestamp:
07/02/2015 08:12:01 PM (5 years ago)
Author:
boonebgorges
Message:

Improved tests for bp_core_new_subnav_item().

File:
1 edited

Legend:

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

    r9988 r9991  
    213213        $this->assertSame( $link, buddypress()->bp_options_nav['foo']['bar']['link'] );
    214214    }
     215
     216    public function test_should_return_false_if_site_admin_only_and_current_user_cannot_bp_moderate() {
     217        // Should already be set to a 0 user.
     218        $this->assertFalse( bp_current_user_can( 'bp_moderate' ) );
     219        $args = array(
     220            'name' => 'Foo',
     221            'slug' => 'foo',
     222            'parent_slug' => 'parent',
     223            'parent_url' => bp_get_root_domain() . '/parent/',
     224            'screen_function' => 'foo',
     225            'site_admin_only' => true,
     226        );
     227
     228        $this->assertFalse( bp_core_new_subnav_item( $args ) );
     229    }
     230
     231    public function test_css_id_should_fall_back_on_slug() {
     232        $args = array(
     233            'name' => 'Foo',
     234            'slug' => 'foo',
     235            'parent_slug' => 'parent',
     236            'parent_url' => bp_get_root_domain() . '/parent/',
     237            'screen_function' => 'foo',
     238        );
     239        bp_core_new_subnav_item( $args );
     240
     241        $this->assertSame( 'foo', buddypress()->bp_options_nav['parent']['foo']['css_id'] );
     242    }
     243
     244    public function test_css_id_should_be_respected() {
     245        $args = array(
     246            'name' => 'Foo',
     247            'slug' => 'foo',
     248            'parent_slug' => 'parent',
     249            'parent_url' => bp_get_root_domain() . '/parent/',
     250            'screen_function' => 'foo',
     251            'item_css_id' => 'bar',
     252        );
     253        bp_core_new_subnav_item( $args );
     254
     255        $this->assertSame( 'bar', buddypress()->bp_options_nav['parent']['foo']['css_id'] );
     256    }
    215257}
Note: See TracChangeset for help on using the changeset viewer.