[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/tests/phpunit/testcases/core/nav/ -> bpGetNavMenuItems.php (source)

   1  <?php
   2  
   3  /**
   4   * @group core
   5   * @group nav
   6   */
   7  class BP_Tests_Core_Nav_BpGetNavMenuItems extends BP_UnitTestCase {
   8      /**
   9       * @ticket BP7110
  10       */
  11      public function test_top_level_link_should_point_to_displayed_user_for_loggedin_user() {
  12          $users = self::factory()->user->create_many( 2 );
  13  
  14          $this->set_current_user( $users[0] );
  15          $user_1_domain = bp_core_get_user_domain( $users[1] );
  16          $this->go_to( $user_1_domain );
  17  
  18          $found = bp_get_nav_menu_items();
  19  
  20          // Find the Activity top-level item.
  21          $activity_item = null;
  22          foreach ( $found as $f ) {
  23              if ( 'activity' === $f->css_id ) {
  24                  $activity_item = $f;
  25                  break;
  26              }
  27          }
  28  
  29          $this->assertSame( trailingslashit( $user_1_domain ) . 'activity/', $activity_item->link );
  30      }
  31  
  32      /**
  33       * @ticket BP7110
  34       */
  35      public function test_top_level_link_should_point_to_displayed_user_for_loggedout_user() {
  36          $user = self::factory()->user->create();
  37  
  38          $this->set_current_user( 0 );
  39          $user_domain = bp_core_get_user_domain( $user );
  40          $this->go_to( $user_domain );
  41  
  42          $found = bp_get_nav_menu_items();
  43  
  44          // Find the Activity top-level item.
  45          $activity_item = null;
  46          foreach ( $found as $f ) {
  47              if ( 'activity' === $f->css_id ) {
  48                  $activity_item = $f;
  49                  break;
  50              }
  51          }
  52  
  53          $this->assertSame( trailingslashit( $user_domain ) . 'activity/', $activity_item->link );
  54      }
  55  }


Generated: Tue Mar 19 01:01:09 2024 Cross-referenced by PHPXref 0.7.1