<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][6907] trunk/tests/testcases: Moves testcases out of unnecessarily nested directory</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/6907">6907</a></dd>
<dt>Author</dt> <dd>boonebgorges</dd>
<dt>Date</dt> <dd>2013-04-11 01:53:07 +0000 (Thu, 11 Apr 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Moves testcases out of unnecessarily nested directory</pre>
<h3>Added Paths</h3>
<ul>
<li>trunk/tests/testcases/activity/</li>
<li><a href="#trunkteststestcasesactivityclassBP_Activity_Activityphp">trunk/tests/testcases/activity/class.BP_Activity_Activity.php</a></li>
<li><a href="#trunkteststestcasesactivityfunctionsphp">trunk/tests/testcases/activity/functions.php</a></li>
<li><a href="#trunkteststestcasesactivitytemplatephp">trunk/tests/testcases/activity/template.php</a></li>
<li>trunk/tests/testcases/admin/</li>
<li><a href="#trunkteststestcasesadminfunctionsphp">trunk/tests/testcases/admin/functions.php</a></li>
<li>trunk/tests/testcases/members/</li>
<li><a href="#trunkteststestcasesmembersfunctionsphp">trunk/tests/testcases/members/functions.php</a></li>
<li>trunk/tests/testcases/routing/</li>
<li><a href="#trunkteststestcasesroutingactivityphp">trunk/tests/testcases/routing/activity.php</a></li>
<li><a href="#trunkteststestcasesroutinganonymousphp">trunk/tests/testcases/routing/anonymous.php</a></li>
<li><a href="#trunkteststestcasesroutingcorephp">trunk/tests/testcases/routing/core.php</a></li>
<li><a href="#trunkteststestcasesroutingfriendsphp">trunk/tests/testcases/routing/friends.php</a></li>
<li><a href="#trunkteststestcasesroutinggroupsphp">trunk/tests/testcases/routing/groups.php</a></li>
<li><a href="#trunkteststestcasesroutingmembersphp">trunk/tests/testcases/routing/members.php</a></li>
<li><a href="#trunkteststestcasesroutingmessagesphp">trunk/tests/testcases/routing/messages.php</a></li>
<li><a href="#trunkteststestcasesroutingsettingsphp">trunk/tests/testcases/routing/settings.php</a></li>
<li><a href="#trunkteststestcasesroutingxprofilephp">trunk/tests/testcases/routing/xprofile.php</a></li>
<li>trunk/tests/testcases/url/</li>
<li><a href="#trunkteststestcasesurlurlphp">trunk/tests/testcases/url/url.php</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li>trunk/tests/testcases/tests/</li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkteststestcasesactivityclassBP_Activity_Activityphp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/activity/class.BP_Activity_Activity.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/activity/class.BP_Activity_Activity.php         (rev 0)
+++ trunk/tests/testcases/activity/class.BP_Activity_Activity.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+<?php
+/**
+ * @group activity
+ */
+class BP_Tests_Activity_Class extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this->old_current_user );
+        }
+
+        public function test_check_exists_by_content() {
+                $content = 'A classy girl who know how to enjoy the freedom of a cup of coffee';
+                $activity = $this->factory->activity->create( array(
+                        'content' => $content,
+                        'type' => 'activity_update',
+                ) );
+
+                $result = BP_Activity_Activity::check_exists_by_content( $content );
+                $this->assertEquals( $activity->id, $result );
+        }
+
+        public function test_delete_activity_item_comments() {
+                $parent_activity = $this->factory->activity->create( array(
+                        'type' => 'activity_update',
+                ) );
+
+                $comments = $this->factory->activity->create_many( 3, array(
+                        'item_id' => $parent_activity->id,
+                        'type' => 'activity_comment',
+                ) );
+
+                BP_Activity_Activity::delete_activity_item_comments( $parent_activity->id );
+
+                $result = BP_Activity_Activity::get( array( 'in' => wp_list_pluck( $comments, 'id' ), ) );
+                $this->assertEmpty( $result['activities'] );
+        }
+
+        /**
+         * @ticket BP4804
+         */
+        public function test_delete_activity_meta_entries() {
+                $activity = $this->factory->activity->create( array(
+                        'type' => 'activity_update',
+                ) );
+
+                bp_activity_update_meta( $activity->id, 'Paul', 'is cool' );
+                BP_Activity_Activity::delete_activity_meta_entries( $activity->id );
+
+                $meta = bp_activity_get_meta( $activity->id, 'Paul' );
+                $this->assertFalse( $meta );
+        }
+
+        public function test_hide_all_for_user() {
+                $activity = $this->factory->activity->create( array(
+                        'type' => 'activity_update',
+                ) );
+
+                BP_Activity_Activity::hide_all_for_user( get_current_user_id() );
+
+                $activity = BP_Activity_Activity::get( array(
+                        'in' => $activity->id,
+                        'show_hidden' => true,
+                ) );
+                $this->assertEquals( $activity['activities'][0]->hide_sitewide, 1 );
+        }
+}
</ins></span></pre></div>
<a id="trunkteststestcasesactivityfunctionsphp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/activity/functions.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/activity/functions.php         (rev 0)
+++ trunk/tests/testcases/activity/functions.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+<?php
+/**
+ * @group activity
+ */
+class BP_Tests_Activity_Functions extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this->old_current_user );
+        }
+
+        /**
+         * @ticket BP4488
+         */
+        public function test_thumbnail_content_images() {
+                // No images
+                $post_content = 'foo bar';
+                $this->assertEquals( bp_activity_thumbnail_content_images( $post_content ), 'foo bar' );
+
+                // Image first, no caption. See #BP4488
+                $post_content = '<img src="http://example.com/foo.jpg" alt="foo" width="40" height="40" class="alignnone size-full wp-image-236" /> foo bar';
+                $this->assertEquals( bp_activity_thumbnail_content_images( $post_content ), '<img src="http://example.com/foo.jpg" width="40" height="40" alt="Thumbnail" class="align-left thumbnail" /> foo bar' );
+
+                // Image first, caption. See #BP4488
+                $post_content = '[caption id="attachment_236" align="alignnone" width="40"]<img src="http://example.com/foo.jpg" alt="FOO!" width="40" height="40" class="size-full wp-image-236" /> FOO![/caption] Awesome.';
+                $this->assertEquals( bp_activity_thumbnail_content_images( $post_content ), '<img src="http://example.com/foo.jpg" width="40" height="40" alt="Thumbnail" class="align-left thumbnail" /> Awesome.' );
+        }
+
+}
</ins></span></pre></div>
<a id="trunkteststestcasesactivitytemplatephp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/activity/template.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/activity/template.php         (rev 0)
+++ trunk/tests/testcases/activity/template.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+<?php
+/**
+ * @group activity
+ */
+class BP_Tests_Activity_Template extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this->old_current_user = get_current_user_id();
+                $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                $this->set_current_user( $this->old_current_user );
+        }
+
+        /**
+         * @ticket BP4735
+         */
+        public function test_user_can_delete() {
+                global $bp;
+
+                $activity = $this->factory->activity->create( array(
+                        'type' => 'activity_update',
+                ) );
+
+                // User can delete his own items
+                $this->assertTrue( bp_activity_user_can_delete( $activity ) );
+
+                // Stash original user
+                $original_user = get_current_user_id();
+
+                // Logged-out user can't delete
+                $this->set_current_user( 0 );
+                $this->assertFalse( bp_activity_user_can_delete( $activity ) );
+
+                // Miscellaneous user can't delete
+                $misc_user = $this->factory->user->create( array( 'role' => 'subscriber' ) );
+                $this->set_current_user( $misc_user );
+                $this->assertFalse( bp_activity_user_can_delete( $activity ) );
+
+                // Item admin can delete
+                $is_single_item = $bp->is_single_item;
+                $bp->is_single_item = true;
+
+                $is_item_admin = $bp->is_item_admin;
+                $bp->is_item_admin = true;
+
+                $this->assertTrue( bp_activity_user_can_delete( $activity ) );
+
+                $bp->is_single_item = $is_single_item;
+                $bp->is_item_admin = $is_item_admin;
+                $this->set_current_user( $original_user );
+        }
+
+}
</ins></span></pre></div>
<a id="trunkteststestcasesadminfunctionsphp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/admin/functions.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/admin/functions.php         (rev 0)
+++ trunk/tests/testcases/admin/functions.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,124 @@
</span><ins>+<?php
+/**
+ * @group admin
+ */
+class BP_Tests_Admin_Functions extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
+
+                if ( ! function_exists( 'bp_admin' ) ) {
+                        require_once( BP_PLUGIN_DIR . 'bp-core/bp-core-admin.php' );
+                }
+
+                if ( ! function_exists( 'bp_new_site' ) ) {
+                        bp_admin();
+                }
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this->old_current_user );
+        }
+
+        public function test_bp_admin_list_table_current_bulk_action() {
+                $_REQUEST['action'] = 'foo';
+                $_REQUEST['action2'] = '-1';
+                $this->assertEquals( bp_admin_list_table_current_bulk_action(), 'foo' );
+
+                $_REQUEST['action'] = '-1';
+                $_REQUEST['action2'] = 'foo';
+                $this->assertEquals( bp_admin_list_table_current_bulk_action(), 'foo' );
+
+                $_REQUEST['action'] = 'bar';
+                $_REQUEST['action2'] = 'foo';
+                $this->assertEquals( bp_admin_list_table_current_bulk_action(), 'foo' );
+        }
+
+        public function test_bp_core_admin_get_active_components_from_submitted_settings() {
+                $get_action = isset( $_GET['action'] ) ? $_GET['action'] : null;
+                $ac = buddypress()->active_components;
+
+                // Standard deactivation from All screen
+                unset( $_GET['action'] );
+                buddypress()->active_components = array(
+                        'activity' => 1,
+                        'friends' => 1,
+                        'groups' => 1,
+                        'members' => 1,
+                        'messages' => 1,
+                        'settings' => 1,
+                        'xprofile' => 1,
+                );
+
+                $submitted = array(
+                        'groups' => 1,
+                        'members' => 1,
+                        'messages' => 1,
+                        'settings' => 1,
+                        'xprofile' => 1,
+                );
+
+                $this->assertEquals( bp_core_admin_get_active_components_from_submitted_settings( $submitted ), array( 'groups' => 1, 'members' => 1, 'messages' => 1, 'settings' => 1, 'xprofile' => 1 ) );
+
+                // Activating deactivated components from the Inactive screen
+                $_GET['action'] = 'inactive';
+                buddypress()->active_components = array(
+                        'activity' => 1,
+                        'members' => 1,
+                        'messages' => 1,
+                        'settings' => 1,
+                        'xprofile' => 1,
+                );
+
+                $submitted2 = array(
+                        'groups' => 1,
+                );
+
+                $this->assertEquals( bp_core_admin_get_active_components_from_submitted_settings( $submitted2 ), array( 'activity' => 1, 'groups' => 1, 'members' => 1, 'messages' => 1, 'settings' => 1, 'xprofile' => 1 ) );
+
+                // Activating from the Retired screen
+                $_GET['action'] = 'retired';
+                buddypress()->active_components = array(
+                        'activity' => 1,
+                        'members' => 1,
+                        'messages' => 1,
+                        'settings' => 1,
+                        'xprofile' => 1,
+                );
+
+                $submitted3 = array(
+                        'forums' => 1,
+                );
+
+                $this->assertEquals( bp_core_admin_get_active_components_from_submitted_settings( $submitted3 ), array( 'activity' => 1, 'forums' => 1, 'members' => 1, 'messages' => 1, 'settings' => 1, 'xprofile' => 1 ) );
+
+                // Deactivating from the Retired screen
+                $_GET['action'] = 'retired';
+                buddypress()->active_components = array(
+                        'activity' => 1,
+                        'forums' => 1,
+                        'members' => 1,
+                        'messages' => 1,
+                        'settings' => 1,
+                        'xprofile' => 1,
+                );
+
+                $submitted4 = array();
+
+                $this->assertEquals( bp_core_admin_get_active_components_from_submitted_settings( $submitted4 ), array( 'activity' => 1, 'members' => 1, 'messages' => 1, 'settings' => 1, 'xprofile' => 1 ) );
+
+                // reset
+                if ( $get_action ) {
+                        $_GET['action'] = $get_action;
+                } else {
+                        unset( $_GET['action'] );
+                }
+
+                buddypress()->active_components = $ac;
+        }
+}
</ins></span></pre></div>
<a id="trunkteststestcasesmembersfunctionsphp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/members/functions.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/members/functions.php         (rev 0)
+++ trunk/tests/testcases/members/functions.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+<?php
+/**
+ * @group members
+ */
+class BP_Tests_Members_Functions extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this->old_current_user = get_current_user_id();
+                $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                $this->set_current_user( $this->old_current_user );
+        }
+
+        /**
+         * ticket BP4915
+         */
+        public function test_bp_core_delete_account() {
+                // Stash
+                $current_user = get_current_user_id();
+                $deletion_disabled = bp_disable_account_deletion();
+
+                // Create an admin for testing
+                $admin_user = $this->factory->user->create( array( 'role' => 'administrator' ) );
+                if ( is_multisite() ) {
+                        if ( ! function_exists( 'grant_super_admin' ) ) {
+                                require_once( ABSPATH . '/wp-admin/includes/ms.php' );
+                        }
+                        grant_super_admin( $admin_user );
+                }
+
+                // 1. Admin can delete user account
+                $this->set_current_user( $admin_user );
+                $user1 = $this->factory->user->create( array( 'role' => 'subscriber' ) );
+                bp_core_delete_account( $user1 );
+                $maybe_user = new WP_User( $user1 );
+                $this->assertEquals( 0, $maybe_user->ID );
+                unset( $maybe_user );
+
+                // 2. Admin cannot delete superadmin account
+                $user2 = $this->factory->user->create( array( 'role' => 'administrator' ) );
+                bp_core_delete_account( $user2 );
+                $maybe_user = new WP_User( $user2 );
+                $this->assertNotEquals( 0, $maybe_user->ID );
+                unset( $maybe_user );
+
+                // User cannot delete other's account
+                $user3 = $this->factory->user->create( array( 'role' => 'subscriber' ) );
+                $user4 = $this->factory->user->create( array( 'role' => 'subscriber' ) );
+                $this->set_current_user( $user3 );
+                bp_core_delete_account( $user4 );
+                $maybe_user = new WP_User( $user4 );
+                $this->assertNotEquals( 0, $maybe_user->ID );
+                unset( $maybe_user );
+
+                // User cannot delete own account when account deletion is disabled
+                $user5 = $this->factory->user->create( array( 'role' => 'subscriber' ) );
+                $this->set_current_user( $user5 );
+                bp_update_option( 'bp-disable-account-deletion', 1 );
+                bp_core_delete_account( $user5 );
+                $maybe_user = new WP_User( $user5 );
+                $this->assertNotEquals( 0, $maybe_user->ID );
+                unset( $maybe_user );
+
+                // User can delete own account when account deletion is enabled
+                $user6 = $this->factory->user->create( array( 'role' => 'subscriber' ) );
+                $this->set_current_user( $user6 );
+                bp_update_option( 'bp-disable-account-deletion', 0 );
+                bp_core_delete_account( $user6 );
+                $maybe_user = new WP_User( $user6 );
+                $this->assertEquals( 0, $maybe_user->ID );
+                unset( $maybe_user );
+
+                // Cleanup
+                $this->set_current_user( $current_user );
+                bp_update_option( 'bp-disable-account-deletion', $deletion_disabled );
+        }
+}
</ins></span></pre></div>
<a id="trunkteststestcasesroutingactivityphp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/routing/activity.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/routing/activity.php         (rev 0)
+++ trunk/tests/testcases/routing/activity.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+<?php
+/**
+ * @group activity
+ * @group routing
+ */
+class BP_Tests_Routing_Activity extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this->old_current_user );
+        }
+
+        function test_activity_directory() {
+                $this->go_to( bp_get_activity_directory_permalink() );
+                $this->assertEquals( bp_get_activity_root_slug(), bp_current_component() );
+        }
+
+        /**
+         * Can't test using bp_activity_get_permalink(); see bp_activity_action_permalink_router().
+         */
+        function test_activity_permalink() {
+                $activity = $this->factory->activity->create();
+
+                $url = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
+                $this->go_to( $url );
+                $this->assertTrue( bp_is_single_activity() );
+        }
+
+        function test_member_activity() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() );
+                $this->assertTrue( bp_is_user_activity() );
+        }
+
+        function test_member_activity_mentions() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/mentions' );
+                $this->assertTrue( bp_is_user_activity() );
+        }
+
+        function test_member_activity_favourites() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/favorites' );
+                $this->assertTrue( bp_is_user_activity() );
+        }
+
+        /**
+         * @group friends
+         */
+        function test_member_activity_friends() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/' . bp_get_friends_slug() );
+                $this->assertTrue( bp_is_user_friends_activity() );
+        }
+
+        /**
+         * @group groups
+         */
+        function test_member_activity_groups() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/' . bp_get_groups_slug() );
+                $this->assertTrue( bp_is_user_groups_activity() );
+        }
+}
</ins></span></pre></div>
<a id="trunkteststestcasesroutinganonymousphp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/routing/anonymous.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/routing/anonymous.php         (rev 0)
+++ trunk/tests/testcases/routing/anonymous.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+<?php
+/**
+ * @group routing
+ */
+class BP_Tests_Routing_Anonymous extends BP_UnitTestCase {
+
+        function test_wordpress_page() {
+                $this->go_to( '/' );
+                $this->assertEmpty( bp_current_component() );
+        }
+
+        function test_nav_menu() {
+                $this->go_to( '/' );
+                $this->assertEmpty( buddypress()->bp_nav );
+        }
+}
</ins></span></pre></div>
<a id="trunkteststestcasesroutingcorephp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/routing/core.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/routing/core.php         (rev 0)
+++ trunk/tests/testcases/routing/core.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+<?php
+/**
+ * @group core
+ * @group routing
+ */
+class BP_Tests_Routing_Core extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this->old_current_user );
+        }
+
+        function test_wordpress_page() {
+                $this->go_to( '/' );
+                $this->assertEmpty( bp_current_component() );
+        }
+
+        function test_nav_menu() {
+                $this->go_to( '/' );
+                $this->assertArrayHasKey( 'activity', buddypress()->bp_nav );
+                $this->assertArrayHasKey( 'profile', buddypress()->bp_nav );
+        }
+}
</ins></span></pre></div>
<a id="trunkteststestcasesroutingfriendsphp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/routing/friends.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/routing/friends.php         (rev 0)
+++ trunk/tests/testcases/routing/friends.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+<?php
+/**
+ * @group friends
+ * @group routing
+ */
+class BP_Tests_Routing_Friends extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this->old_current_user );
+        }
+
+        function test_member_friends() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_friends_slug() );
+                $this->assertTrue( bp_is_user_friends() );
+        }
+
+        function test_member_friends_requests() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_friends_slug() . '/requests' );
+                $this->assertTrue( bp_is_user_friend_requests() );
+        }
+}
</ins></span></pre></div>
<a id="trunkteststestcasesroutinggroupsphp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/routing/groups.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/routing/groups.php         (rev 0)
+++ trunk/tests/testcases/routing/groups.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+<?php
+/**
+ * @group groups
+ * @group routing
+ */
+class BP_Tests_Routing_Groups extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this->old_current_user );
+        }
+
+        function test_member_groups() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_groups_slug() );
+                $this->assertTrue( bp_is_user_groups() );
+        }
+
+        function test_member_groups_invitations() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_groups_slug() . '/invites' );
+                $this->assertTrue( bp_is_user_groups() && bp_is_current_action( 'invites' ) );
+        }
+}
</ins></span></pre></div>
<a id="trunkteststestcasesroutingmembersphp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/routing/members.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/routing/members.php         (rev 0)
+++ trunk/tests/testcases/routing/members.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+<?php
+/**
+ * @group members
+ * @group routing
+ */
+class BP_Tests_Routing_Members extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->factory->user->create( array( 'user_login' => 'paulgibbs', 'role' => 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this->old_current_user );
+        }
+
+        function test_members_directory() {
+                $this->go_to( bp_get_members_directory_permalink() );
+                $this->assertEquals( bp_get_members_root_slug(), bp_current_component() );
+        }
+
+        function test_member_permalink() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) );
+                $this->assertTrue( bp_is_my_profile() );
+        }
+}
</ins></span></pre></div>
<a id="trunkteststestcasesroutingmessagesphp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/routing/messages.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/routing/messages.php         (rev 0)
+++ trunk/tests/testcases/routing/messages.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+<?php
+/**
+ * @group messages
+ * @group routing
+ */
+class BP_Tests_Routing_Messages extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this->old_current_user );
+        }
+
+        function test_member_messages() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() );
+                $this->assertTrue( bp_is_messages_inbox() );
+        }
+
+        function test_member_messages_sentbox() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() . '/sentbox' );
+                $this->assertTrue( bp_is_messages_sentbox() );
+        }
+
+        function test_member_messages_compose() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() . '/compose' );
+                $this->assertTrue( bp_is_messages_compose_screen() );
+        }
+
+        function test_member_messages_notices() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() . '/notices' );
+                $this->assertTrue( bp_is_notices() );
+        }
+}
</ins></span></pre></div>
<a id="trunkteststestcasesroutingsettingsphp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/routing/settings.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/routing/settings.php         (rev 0)
+++ trunk/tests/testcases/routing/settings.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+<?php
+/**
+ * @group settings
+ * @group routing
+ */
+class BP_Tests_Routing_Settings extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this->old_current_user );
+        }
+
+        function test_member_settings() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() );
+                $this->assertTrue( bp_is_user_settings_general() );
+        }
+
+        function test_member_settings_notifications() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/notifications' );
+                $this->assertTrue( bp_is_user_settings_notifications() );
+        }
+
+        // @todo How best to test this?
+        /*function bp_is_user_settings_account_capbilities() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/capabilities' );
+        }*/
+
+        function bp_is_user_settings_account_delete() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/delete-account' );
+                $this->assertTrue( bp_is_user_settings_account_delete() );
+        }
+}
</ins></span></pre></div>
<a id="trunkteststestcasesroutingxprofilephp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/routing/xprofile.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/routing/xprofile.php         (rev 0)
+++ trunk/tests/testcases/routing/xprofile.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+<?php
+/**
+ * @group xprofile
+ * @group routing
+ */
+class BP_Tests_Routing_XProfile extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this->old_current_user );
+        }
+
+        function test_member_profile() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . buddypress()->profile->slug );
+                $this->assertTrue( bp_is_user_profile() );
+        }
+
+        function test_member_profile_edit() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . buddypress()->profile->slug . '/edit' );
+                $this->assertTrue( bp_is_user_profile_edit() );
+        }
+
+        function test_member_profile_change_avatar() {
+                $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . buddypress()->profile->slug . '/change-avatar' );
+                $this->assertTrue( bp_is_user_change_avatar() );        
+        }
+}
</ins></span></pre></div>
<a id="trunkteststestcasesurlurlphp"></a>
<div class="addfile"><h4>Added: trunk/tests/testcases/url/url.php (0 => 6907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/testcases/url/url.php         (rev 0)
+++ trunk/tests/testcases/url/url.php        2013-04-11 01:53:07 UTC (rev 6907)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+<?php
+/**
+ * @group url
+ */
+class BP_Tests_URL extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this->old_current_user );
+        }
+
+        function test_bp_core_ajax_url() {
+                $forced = force_ssl_admin();
+
+                // (1) HTTPS off
+                force_ssl_admin( false );
+                $_SERVER['HTTPS'] = 'off';
+
+                // (1a) Front-end
+                $this->go_to( '/' );
+                $this->assertEquals( bp_core_ajax_url(), get_site_url( bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http' ) );
+
+                // (1b) Dashboard
+                $this->go_to( '/wp-admin' );
+                $this->assertEquals( bp_core_ajax_url(), get_site_url( bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http' ) );
+
+                // (2) FORCE_SSL_ADMIN
+                force_ssl_admin( true );
+
+                // (2a) Front-end
+                $this->go_to( '/' );
+                $this->assertEquals( bp_core_ajax_url(), get_site_url( bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http' ) );
+
+                // (2b) Dashboard
+                $this->go_to( '/wp-admin' );
+                $this->assertEquals( bp_core_ajax_url(), get_site_url( bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'https' ) );
+
+                force_ssl_admin( $forced );
+
+                // (3) Multisite, root blog other than 1
+                if ( is_multisite() ) {
+                        $original_root_blog = bp_get_root_blog_id();
+                        $blog_id = $this->factory->blog->create();
+                        buddypress()->root_blog_id = $blog_id;
+
+                        switch_to_blog( $blog_id );
+                        $blog_details = get_blog_details();
+
+                        $this->go_to( '/' );
+                        $this->assertEquals( bp_core_ajax_url(), $blog_details->siteurl . '/wp-admin/admin-ajax.php' );
+
+                        restore_current_blog();
+                        buddypress()->root_blog_id = $original_root_blog;
+                }
+
+        }
+}
</ins></span></pre>
</div>
</div>
</body>
</html>