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' ) { |
633 | 633 | $page_titles = array( |
634 | 634 | 'activity' => _x( 'Activity', 'Page title for the Activity directory.', 'buddypress' ), |
635 | 635 | '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' ), |
637 | 637 | 'members' => _x( 'Members', 'Page title for the Members directory.', 'buddypress' ), |
638 | 638 | 'activate' => _x( 'Activate', 'Page title for the user activation screen.', 'buddypress' ), |
639 | 639 | 'register' => _x( 'Register', 'Page title for the user registration screen.', 'buddypress' ), |
… |
… |
function bp_core_add_page_mappings( $components, $existing = 'keep' ) { |
657 | 657 | } |
658 | 658 | |
659 | 659 | // 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'] ); |
662 | 662 | } |
663 | 663 | |
664 | 664 | // Members must always have a page, no matter what. |
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 { |
208 | 208 | |
209 | 209 | $missing_pages = array(); |
210 | 210 | foreach( buddypress()->admin->notices as $notice ) { |
| 211 | if ( false !== strpos( $notice['message'], 'BuddyPress is almost ready' ) ) { |
| 212 | continue; |
| 213 | } |
| 214 | |
211 | 215 | preg_match_all( '/<strong>(.+?)<\/strong>/', $notice['message'], $missing_pages ); |
212 | 216 | } |
213 | 217 | |
214 | | $this->assertNotContains( 'Register', $missing_pages[1] ); |
215 | | $this->assertNotContains( 'Activate', $missing_pages[1] ); |
| 218 | $this->assertEmpty( $missing_pages ); |
216 | 219 | |
217 | 220 | // Reset buddypress() vars |
218 | 221 | $bp->pages = $reset_bp_pages; |
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 { |
721 | 721 | $result = bp_email_add_link_color_to_template( $content, 'template', 'add-content' ); |
722 | 722 | $this->assertContains( $link_color, $result ); |
723 | 723 | } |
| 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 | } |
724 | 745 | } |