Changeset 13433 for trunk/tests/phpunit/testcases/routing/activity.php
- Timestamp:
- 03/07/2023 04:28:08 AM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/routing/activity.php
r13431 r13433 6 6 class BP_Tests_Routing_Activity extends BP_UnitTestCase { 7 7 protected $old_current_user = 0; 8 protected $permalink_structure = ''; 8 9 9 10 public function set_up() { … … 11 12 12 13 $this->old_current_user = get_current_user_id(); 14 $this->permalink_structure = get_option( 'permalink_structure', '' ); 13 15 $this->set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 14 16 } … … 17 19 parent::tear_down(); 18 20 $this->set_current_user( $this->old_current_user ); 21 $this->set_permalink_structure( $this->permalink_structure ); 19 22 } 20 23 21 24 function test_activity_directory() { 25 $this->set_permalink_structure( '/%postname%/' ); 22 26 $this->go_to( bp_get_activity_directory_permalink() ); 23 27 … … 32 36 */ 33 37 function test_activity_permalink() { 38 $this->set_permalink_structure( '/%postname%/' ); 34 39 $a = self::factory()->activity->create(); 35 40 $activity = self::factory()->activity->get_object_by_id( $a ); 36 41 37 $url = bp_core_get_user_domain( $activity->user_id ) . bp_get_activity_slug() . '/' . $activity->id . '/'; 42 $url = bp_members_get_user_url( 43 $activity->user_id, 44 array( 45 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 46 'single_item_action' => $activity->id, 47 ) 48 ); 38 49 $this->go_to( $url ); 39 50 $this->assertTrue( bp_is_single_activity() ); … … 41 52 42 53 function test_member_activity() { 43 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() ); 54 $this->set_permalink_structure( '/%postname%/' ); 55 $this->go_to( 56 bp_members_get_user_url( 57 bp_loggedin_user_id(), 58 array( 59 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 60 ) 61 ) 62 ); 44 63 $this->assertTrue( bp_is_user_activity() ); 45 64 } 46 65 47 66 function test_member_activity_mentions() { 48 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/mentions' ); 67 $this->set_permalink_structure( '/%postname%/' ); 68 $this->go_to( 69 bp_members_get_user_url( 70 bp_loggedin_user_id(), 71 array( 72 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 73 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_activity_mentions', 'mentions' ), 74 ) 75 ) 76 ); 49 77 $this->assertTrue( bp_is_user_activity() ); 50 78 } 51 79 52 80 function test_member_activity_favourites() { 53 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/favorites' ); 81 $this->set_permalink_structure( '/%postname%/' ); 82 $this->go_to( 83 bp_members_get_user_url( 84 bp_loggedin_user_id(), 85 array( 86 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 87 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_activity_favorites', 'favorites' ), 88 ) 89 ) 90 ); 54 91 $this->assertTrue( bp_is_user_activity() ); 55 92 } … … 59 96 */ 60 97 function test_member_activity_friends() { 61 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/' . bp_get_friends_slug() ); 98 $this->set_permalink_structure( '/%postname%/' ); 99 $this->go_to( 100 bp_members_get_user_url( 101 bp_loggedin_user_id(), 102 array( 103 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 104 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_activity_friends', bp_get_friends_slug() ), 105 ) 106 ) 107 ); 62 108 $this->assertTrue( bp_is_user_friends_activity() ); 63 109 } … … 67 113 */ 68 114 function test_member_activity_groups() { 69 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/' . bp_get_groups_slug() ); 115 $this->set_permalink_structure( '/%postname%/' ); 116 $this->go_to( 117 bp_members_get_user_url( 118 bp_loggedin_user_id(), 119 array( 120 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 121 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_activity_groups', bp_get_groups_slug() ), 122 ) 123 ) 124 ); 70 125 $this->assertTrue( bp_is_user_groups_activity() ); 71 126 }
Note: See TracChangeset
for help on using the changeset viewer.