[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/tests/phpunit/testcases/core/template/ -> bpUserHasAccess.php (source)

   1  <?php
   2  /**
   3   * @group core
   4   * @group template
   5   */
   6  class BP_Tests_Core_Template_BpUserHasAccess extends BP_UnitTestCase {
   7  	public function test_should_return_true_for_bp_moderate_user() {
   8          $users = self::factory()->user->create_many( 2 );
   9  
  10          $this->grant_bp_moderate( $users[0] );
  11          $this->set_current_user( $users[0] );
  12  
  13          $this->go_to( bp_core_get_user_domain( $users[1] ) );
  14  
  15          $this->assertTrue( bp_user_has_access( $users[0] ) );
  16      }
  17  
  18      public function test_should_return_false_on_anothers_profile_for_user_without_bp_moderate() {
  19          $users = self::factory()->user->create_many( 2 );
  20  
  21          $this->set_current_user( $users[0] );
  22  
  23          $this->go_to( bp_core_get_user_domain( $users[1] ) );
  24  
  25          $this->assertFalse( bp_user_has_access( $users[0] ) );
  26      }
  27  
  28  	public function test_should_return_true_on_own_profile() {
  29          $users = self::factory()->user->create_many( 2 );
  30  
  31          $this->set_current_user( $users[0] );
  32  
  33          $this->go_to( bp_core_get_user_domain( $users[0] ) );
  34  
  35          $this->assertTrue( bp_user_has_access( $users[0] ) );
  36      }
  37  }


Generated: Mon Jan 18 01:01:36 2021 Cross-referenced by PHPXref 0.7.1