Skip to:
Content

BuddyPress.org

Ticket #7150: 7150.patch

File 7150.patch, 3.1 KB (added by imath, 9 years ago)
  • src/bp-core/bp-core-functions.php

    diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php
    index 6acfb73..34df2c5 100644
    function bp_core_add_page_mappings( $components, $existing = 'keep' ) { 
    633633        $page_titles = array(
    634634                'activity' => _x( 'Activity', 'Page title for the Activity directory.',       'buddypress' ),
    635635                'groups'   => _x( 'Groups',   'Page title for the Groups directory.',         'buddypress' ),
    636                 'sites'    => _x( 'Sites',    'Page title for the Sites directory.',          'buddypress' ),
     636                'blogs'    => _x( 'Sites',    'Page title for the Sites directory.',          'buddypress' ),
    637637                'members'  => _x( 'Members',  'Page title for the Members directory.',        'buddypress' ),
    638638                'activate' => _x( 'Activate', 'Page title for the user activation screen.',   'buddypress' ),
    639639                'register' => _x( 'Register', 'Page title for the user registration screen.', 'buddypress' ),
    function bp_core_add_page_mappings( $components, $existing = 'keep' ) { 
    657657        }
    658658
    659659        // No need for a Sites directory unless we're on multisite.
    660         if ( ! is_multisite() && isset( $pages_to_create['sites'] ) ) {
    661                 unset( $pages_to_create['sites'] );
     660        if ( ! is_multisite() && isset( $pages_to_create['blogs'] ) ) {
     661                unset( $pages_to_create['blogs'] );
    662662        }
    663663
    664664        // Members must always have a page, no matter what.
  • tests/phpunit/testcases/admin/functions.php

    diff --git tests/phpunit/testcases/admin/functions.php tests/phpunit/testcases/admin/functions.php
    index cc6ea19..9492d93 100644
    class BP_Tests_Admin_Functions extends BP_UnitTestCase { 
    208208
    209209                $missing_pages = array();
    210210                foreach( buddypress()->admin->notices as $notice ) {
     211                        if ( false !== strpos( $notice['message'], 'BuddyPress is almost ready' ) ) {
     212                                continue;
     213                        }
     214
    211215                        preg_match_all( '/<strong>(.+?)<\/strong>/', $notice['message'], $missing_pages );
    212216                }
    213217
    214                 $this->assertNotContains( 'Register', $missing_pages[1] );
    215                 $this->assertNotContains( 'Activate', $missing_pages[1] );
     218                $this->assertEmpty( $missing_pages );
    216219
    217220                // Reset buddypress() vars
    218221                $bp->pages = $reset_bp_pages;
  • tests/phpunit/testcases/core/functions.php

    diff --git tests/phpunit/testcases/core/functions.php tests/phpunit/testcases/core/functions.php
    index c541c02..e1e2820 100644
    class BP_Tests_Core_Functions extends BP_UnitTestCase { 
    721721                $result      = bp_email_add_link_color_to_template( $content, 'template', 'add-content' );
    722722                $this->assertContains( $link_color, $result );
    723723        }
     724
     725        /**
     726         * @group bp_core_add_page_mappings
     727         */
     728        public function test_bp_core_add_page_mappings() {
     729                $bp = buddypress();
     730                $reset_bp_pages = $bp->pages;
     731
     732                $expected = array( 'activity', 'groups', 'members' );
     733                if ( is_multisite() ) {
     734                        $expected = array( 'activity', 'blogs', 'groups', 'members' );
     735                }
     736
     737                bp_core_add_page_mappings( $bp->active_components );
     738                $bp_pages = array_keys( bp_get_option( 'bp-pages' ) );
     739                sort( $bp_pages );
     740
     741                $this->assertEquals( $expected, $bp_pages );
     742
     743                $bp->pages = $reset_bp_pages;
     744        }
    724745}