Changeset 13433 for trunk/tests/phpunit/testcases/core/nav/bpCoreMaybeHookNewSubnavScreenFunction.php
- Timestamp:
- 03/07/2023 04:28:08 AM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/nav/bpCoreMaybeHookNewSubnavScreenFunction.php
r11737 r13433 5 5 */ 6 6 class BP_Tests_Core_Nav_BpCoreMaybeHookNewSubnavScreenFunction 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 public function test_user_has_access_true_no_callable_function() { … … 57 69 $old_current_user = get_current_user_id(); 58 70 $this->set_current_user( $u ); 59 60 $this->go_to( bp_core_get_user_domain( $u ) ); 61 62 $subnav_item = array( 63 'user_has_access' => false, 64 ); 65 66 // Just test relevant info 67 $found = bp_core_maybe_hook_new_subnav_screen_function( $subnav_item ); 68 $this->assertSame( 'failure', $found['status'] ); 69 $this->assertSame( bp_core_get_user_domain( $u ), $found['redirect_args']['root'] ); 71 $this->set_permalink_structure( '/%postname%/' ); 72 73 $this->go_to( bp_members_get_user_url( $u ) ); 74 75 $subnav_item = array( 76 'user_has_access' => false, 77 ); 78 79 // Just test relevant info 80 $found = bp_core_maybe_hook_new_subnav_screen_function( $subnav_item ); 81 $this->assertSame( 'failure', $found['status'] ); 82 $this->assertSame( bp_members_get_user_url( $u ), $found['redirect_args']['root'] ); 70 83 71 84 $this->set_current_user( $old_current_user ); … … 77 90 $old_current_user = get_current_user_id(); 78 91 $this->set_current_user( $u1 ); 79 80 $this->go_to( bp_core_get_user_domain( $u2 ) ); 92 $this->set_permalink_structure( '/%postname%/' ); 93 94 $this->go_to( bp_members_get_user_url( $u2 ) ); 81 95 82 96 $old_bp_nav = buddypress()->bp_nav; … … 104 118 105 119 $this->assertSame( 'failure', $found['status'] ); 106 $this->assertSame( bp_ core_get_user_domain( $u2 ), $found['redirect_args']['root'] );120 $this->assertSame( bp_members_get_user_url( $u2 ), $found['redirect_args']['root'] ); 107 121 } 108 122 … … 112 126 $old_current_user = get_current_user_id(); 113 127 $this->set_current_user( $u1 ); 114 115 $this->go_to( bp_core_get_user_domain( $u2 ) ); 128 $this->set_permalink_structure( '/%postname%/' ); 129 130 $this->go_to( bp_members_get_user_url( $u2 ) ); 116 131 117 132 $old_bp_nav = buddypress()->bp_nav; … … 140 155 141 156 $this->assertSame( 'failure', $found['status'] ); 142 $this->assertSame( bp_core_get_user_domain( $u2 ) . bp_get_activity_slug() . '/', $found['redirect_args']['root'] ); 157 $this->assertSame( 158 bp_members_get_user_url( 159 $u2, 160 array( 161 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 162 ) 163 ), 164 $found['redirect_args']['root'] 165 ); 143 166 } 144 167
Note: See TracChangeset
for help on using the changeset viewer.