Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/06/2015 03:16:07 PM (11 years ago)
Author:
boonebgorges
Message:

Add some tests for trailingslashit() behavior in bp_core_new_subnav_item().

See #6353.

File:
1 edited

Legend:

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

    r9139 r9700  
    342342                $this->set_current_user( $old_current_user );
    343343        }
     344
     345        /**
     346         * @group bp_core_new_subnav_item()
     347         */
     348        public function test_bp_core_new_subnav_item_should_trailingslash_link_when_link_is_autogenerated_using_slug() {
     349                bp_core_new_subnav_item( array(
     350                        'name' => 'bar',
     351                        'slug' => 'bar',
     352                        'parent_slug' => 'foo',
     353                        'parent_url' => bp_get_root_domain() . 'foo/',
     354                        'screen_function' => 'foo',
     355                ) );
     356
     357                $expected = bp_get_root_domain() . 'foo/bar/';
     358                $this->assertSame( $expected, buddypress()->bp_options_nav['foo']['bar']['link'] );
     359        }
     360
     361        /**
     362         * @group bp_core_new_subnav_item()
     363         */
     364        public function test_bp_core_new_subnav_item_should_trailingslash_link_when_link_is_autogenerated_not_using_slug() {
     365                bp_core_new_nav_item( array(
     366                        'name' => 'foo',
     367                        'slug' => 'foo-parent',
     368                        'link' => bp_get_root_domain() . 'foo-parent/',
     369                        'default_subnav_slug' => 'bar',
     370                        'screen_function' => 'foo',
     371                ) );
     372
     373                bp_core_new_subnav_item( array(
     374                        'name' => 'bar',
     375                        'slug' => 'bar',
     376                        'parent_slug' => 'foo-parent',
     377                        'parent_url' => bp_get_root_domain() . 'foo-parent/',
     378                        'screen_function' => 'bar',
     379                ) );
     380
     381                $expected = bp_get_root_domain() . 'foo-parent/';
     382                $this->assertSame( $expected, buddypress()->bp_options_nav['foo-parent']['bar']['link'] );
     383        }
    344384}
Note: See TracChangeset for help on using the changeset viewer.