[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/tests/phpunit/testcases/routing/ -> root-profiles.php (source)

   1  <?php
   2  /**
   3   * @group members
   4   * @group routing
   5   * @group root_profiles
   6   */
   7  class BP_Tests_Routing_Members_Root_Profiles extends BP_UnitTestCase {
   8      protected $old_current_user = 0;
   9      protected $u;
  10  
  11  	public function setUp() {
  12          parent::setUp();
  13  
  14          add_filter( 'bp_core_enable_root_profiles', '__return_true' );
  15  
  16          $this->old_current_user = get_current_user_id();
  17          $uid = self::factory()->user->create( array(
  18              'user_login' => 'boone',
  19              'user_nicename' => 'boone',
  20          ) );
  21          $this->u = new WP_User( $uid );
  22          $this->set_current_user( $uid );
  23      }
  24  
  25  	public function tearDown() {
  26          parent::tearDown();
  27          $this->set_current_user( $this->old_current_user );
  28          remove_filter( 'bp_core_enable_root_profiles', '__return_true' );
  29      }
  30  
  31  	public function test_members_directory() {
  32          $this->go_to( home_url( bp_get_members_root_slug() ) );
  33          $this->assertEquals( bp_get_members_root_slug(), bp_current_component() );
  34      }
  35  
  36  	public function test_member_permalink() {
  37          $domain = home_url( $this->u->user_nicename );
  38          $this->go_to( $domain );
  39  
  40          $this->assertTrue( bp_is_user() );
  41          $this->assertTrue( bp_is_my_profile() );
  42          $this->assertEquals( $this->u->ID, bp_displayed_user_id() );
  43      }
  44  
  45      /**
  46       * @ticket BP6475
  47       */
  48      public function test_member_permalink_when_members_page_is_nested_under_wp_page() {
  49          $p = self::factory()->post->create( array(
  50              'post_type' => 'page',
  51              'post_name' => 'foo',
  52          ) );
  53  
  54          $members_page = get_page_by_path( 'members' );
  55          wp_update_post( array(
  56              'ID' => $members_page->ID,
  57              'post_parent' => $p,
  58          ) );
  59  
  60          $domain = home_url( $this->u->user_nicename );
  61          $this->go_to( $domain );
  62  
  63          $this->assertTrue( bp_is_user() );
  64          $this->assertTrue( bp_is_my_profile() );
  65          $this->assertEquals( $this->u->ID, bp_displayed_user_id() );
  66      }
  67  
  68  	public function test_member_activity_page() {
  69          $url = home_url( $this->u->user_nicename ) . '/' . bp_get_activity_slug();
  70          $this->go_to( $url );
  71  
  72          $this->assertTrue( bp_is_user() );
  73          $this->assertTrue( bp_is_my_profile() );
  74          $this->assertEquals( $this->u->ID, bp_displayed_user_id() );
  75  
  76          $this->assertTrue( bp_is_activity_component() );
  77      }
  78  }


Generated: Fri Nov 15 01:01:37 2019 Cross-referenced by PHPXref 0.7.1