[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @group activity 4 * @group routing 5 */ 6 class BP_Tests_Routing_Activity extends BP_UnitTestCase { 7 protected $old_current_user = 0; 8 9 public function setUp() { 10 parent::setUp(); 11 12 $this->old_current_user = get_current_user_id(); 13 $this->set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 14 } 15 16 public function tearDown() { 17 parent::tearDown(); 18 $this->set_current_user( $this->old_current_user ); 19 } 20 21 function test_activity_directory() { 22 $this->go_to( bp_get_activity_directory_permalink() ); 23 $this->assertEquals( bp_get_activity_root_slug(), bp_current_component() ); 24 } 25 26 /** 27 * Can't test using bp_activity_get_permalink(); see bp_activity_action_permalink_router(). 28 */ 29 function test_activity_permalink() { 30 $a = self::factory()->activity->create(); 31 $activity = self::factory()->activity->get_object_by_id( $a ); 32 33 $url = bp_core_get_user_domain( $activity->user_id ) . bp_get_activity_slug() . '/' . $activity->id . '/'; 34 $this->go_to( $url ); 35 $this->assertTrue( bp_is_single_activity() ); 36 } 37 38 function test_member_activity() { 39 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() ); 40 $this->assertTrue( bp_is_user_activity() ); 41 } 42 43 function test_member_activity_mentions() { 44 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/mentions' ); 45 $this->assertTrue( bp_is_user_activity() ); 46 } 47 48 function test_member_activity_favourites() { 49 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/favorites' ); 50 $this->assertTrue( bp_is_user_activity() ); 51 } 52 53 /** 54 * @group friends 55 */ 56 function test_member_activity_friends() { 57 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/' . bp_get_friends_slug() ); 58 $this->assertTrue( bp_is_user_friends_activity() ); 59 } 60 61 /** 62 * @group groups 63 */ 64 function test_member_activity_groups() { 65 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/' . bp_get_groups_slug() ); 66 $this->assertTrue( bp_is_user_groups_activity() ); 67 } 68 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Dec 22 01:00:54 2024 | Cross-referenced by PHPXref 0.7.1 |