user->create( array( 'role' => 'subscriber' ) ) ); $this->permalink_structure = get_option( 'permalink_structure', '' ); $this->set_permalink_structure( '/%postname%/' ); } public function tear_down() { $this->set_permalink_structure( $this->permalink_structure ); parent::tear_down(); } public function test_wordpress_page() { $this->go_to( '/' ); $this->assertEmpty( bp_current_component() ); } /** * @ticket BP9300 */ public function test_buddypress_directory_is_home_false() { $is_home_value = null; // Capture the is_home value during pre_get_posts for the main query. $callback = function ( $query ) use ( &$is_home_value ) { if ( $query->is_main_query() ) { $is_home_value = $query->is_home; } }; add_action( 'pre_get_posts', $callback ); $this->go_to( bp_get_members_directory_permalink() ); remove_action( 'pre_get_posts', $callback ); $this->assertFalse( $is_home_value, 'is_home should be false for a BuddyPress directory page on the main query.' ); } }