Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/25/2014 06:52:58 PM (10 years ago)
Author:
boonebgorges
Message:

Don't remove Register and Activate pages from bp_core_get_directory_page_ids().

These two pages do not correspond to components, so they should be excluded
from bp_is_active() checks.

Props imath.
Fixes #6043.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/core/functions.php

    r9177 r9180  
    369369
    370370    /**
     371     * @group bp_core_get_directory_page_ids
     372     */
     373    public function test_bp_core_get_directory_page_ids_should_contain_register_and_activet_pages_when_registration_is_open() {
     374        add_filter( 'bp_get_signup_allowed', '__return_true', 999 );
     375
     376        $ac = buddypress()->active_components;
     377        bp_core_add_page_mappings( array_keys( $ac ) );
     378
     379        $page_ids = bp_core_get_directory_page_ids();
     380        $page_names = array_keys( $page_ids );
     381
     382        $this->assertContains( 'register', $page_names );
     383        $this->assertContains( 'activate', $page_names );
     384
     385        remove_filter( 'bp_get_signup_allowed', '__return_true', 999 );
     386    }
     387
     388    /**
     389     * @group bp_core_get_directory_page_ids
     390     */
     391    public function test_bp_core_get_directory_page_ids_should_not_contain_register_and_activet_pages_when_registration_is_closed() {
     392
     393        // Make sure the pages exist, to verify they're filtered out.
     394        add_filter( 'bp_get_signup_allowed', '__return_true', 999 );
     395        $ac = buddypress()->active_components;
     396        bp_core_add_page_mappings( array_keys( $ac ) );
     397        remove_filter( 'bp_get_signup_allowed', '__return_true', 999 );
     398
     399        add_filter( 'bp_get_signup_allowed', '__return_false', 999 );
     400        $page_ids = bp_core_get_directory_page_ids();
     401        remove_filter( 'bp_get_signup_allowed', '__return_false', 999 );
     402
     403        $page_names = array_keys( $page_ids );
     404
     405        $this->assertNotContains( 'register', $page_names );
     406        $this->assertNotContains( 'activate', $page_names );
     407    }
     408
     409    /**
    371410     * @group bp_core_get_directory_pages
    372411     */
Note: See TracChangeset for help on using the changeset viewer.