- Timestamp:
- 03/23/2023 07:35:38 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/nav/bpCoreNewSubnavItem.php
r13433 r13441 5 5 */ 6 6 class BP_Tests_Core_Nav_BpCoreNewSubnavItem extends BP_UnitTestCase { 7 protected $permalink_structure = ''; 8 9 public function set_up() { 10 parent::set_up(); 11 $this->permalink_structure = get_option( 'permalink_structure', '' ); 12 } 13 14 public function tear_down() { 15 $this->set_permalink_structure( $this->permalink_structure ); 16 17 parent::tear_down(); 18 } 7 19 8 20 /** … … 10 22 */ 11 23 public function test_user_subnav() { 24 $this->set_permalink_structure( '/%postname%/' ); 12 25 $bp_options_nav = buddypress()->bp_options_nav; 13 26 … … 16 29 $this->set_current_user( $u ); 17 30 18 $user_domain = bp_members_get_user_url( $u ); 19 20 $this->go_to( $user_domain ); 31 $this->go_to( bp_members_get_user_url( $u ) ); 21 32 22 33 bp_core_new_nav_item( array( 23 34 'name' => 'Foo Parent', 24 35 'slug' => 'foo-parent', 25 'link' => trailingslashit( $user_domain . 'foo-parent' ),26 36 'screen_function' => 'foo_screen_function', 27 37 'position' => 10, … … 31 41 'name' => 'Foo', 32 42 'slug' => 'foo', 33 'parent_url' => trailingslashit( $user_domain . 'foo-parent' ), 43 'parent_url' => bp_members_get_user_url( 44 $u, 45 array( 46 'single_item_component' => 'foo-parent', 47 ) 48 ), 34 49 'parent_slug' => 'foo-parent', 35 50 'screen_function' => 'foo_screen_function', … … 39 54 $expected = array( 40 55 'name' => 'Foo', 41 'link' => trailingslashit( $user_domain . 'foo-parent/foo' ), 56 'link' => bp_members_get_user_url( 57 $u, 58 array( 59 'single_item_component' => 'foo-parent', 60 'single_item_action' => 'foo', 61 ) 62 ), 42 63 'slug' => 'foo', 43 64 'css_id' => 'foo', … … 63 84 'slug' => 'foo', 64 85 'parent_slug' => 'foo', 65 'parent_url' => 'foo',66 86 'screen_function' => 'foo', 67 87 ) ) ); … … 71 91 'name' => 'foo', 72 92 'parent_slug' => 'foo', 73 'parent_url' => 'foo',74 93 'screen_function' => 'foo', 75 94 ) ) ); … … 79 98 'name' => 'foo', 80 99 'slug' => 'foo', 81 'parent_url' => 'foo',82 'screen_function' => 'foo',83 ) ) );84 85 // 'parent_url'86 $this->assertFalse( bp_core_new_subnav_item( array(87 'name' => 'foo',88 'slug' => 'foo',89 'parent_slug' => 'foo',90 100 'screen_function' => 'foo', 91 101 ) ) ); … … 96 106 'slug' => 'foo', 97 107 'parent_slug' => 'foo', 98 'parent_url' => 'foo',99 108 ) ) ); 100 109 } … … 179 188 'name' => 'Foo', 180 189 'slug' => 'foo', 190 'url' => 'http://example.com/foo/', 181 191 'screen_function' => 'foo', 182 192 'default_subnav_slug' => 'bar', … … 191 201 ) ); 192 202 193 $this->assertSame( 'http://example.com/foo/ ', buddypress()->bp_options_nav['foo']['bar']['link'] );203 $this->assertSame( 'http://example.com/foo/bar/', buddypress()->bp_options_nav['foo']['bar']['link'] ); 194 204 195 205 // clean up … … 202 212 */ 203 213 public function test_should_trailingslash_link_when_link_is_autogenerated_using_slug() { 214 $this->set_permalink_structure( '/%postname%/' ); 204 215 bp_core_new_nav_item( array( 205 216 'name' => 'Foo', … … 225 236 */ 226 237 public function test_should_trailingslash_link_when_link_is_autogenerated_not_using_slug() { 238 $this->set_permalink_structure( '/%postname%/' ); 227 239 bp_core_new_nav_item( array( 228 240 'name' => 'foo', … … 241 253 ) ); 242 254 243 $expected = bp_get_root_domain() . '/foo-parent/ ';255 $expected = bp_get_root_domain() . '/foo-parent/bar/'; 244 256 $this->assertSame( $expected, buddypress()->bp_options_nav['foo-parent']['bar']['link'] ); 245 257 }
Note: See TracChangeset
for help on using the changeset viewer.