<!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>+&lt;?php
+/**
+ * @group activity
+ */
+class BP_Tests_Activity_Class extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this-&gt;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-&gt;factory-&gt;activity-&gt;create( array(
+                        'content' =&gt; $content,
+                        'type'    =&gt; 'activity_update',
+                ) );
+
+                $result = BP_Activity_Activity::check_exists_by_content( $content );
+                $this-&gt;assertEquals( $activity-&gt;id, $result );
+        }
+
+        public function test_delete_activity_item_comments() {
+                $parent_activity = $this-&gt;factory-&gt;activity-&gt;create( array(
+                        'type' =&gt; 'activity_update',
+                ) );
+
+                $comments = $this-&gt;factory-&gt;activity-&gt;create_many( 3, array(
+                        'item_id' =&gt; $parent_activity-&gt;id,
+                        'type'    =&gt; 'activity_comment',
+                ) );
+
+                BP_Activity_Activity::delete_activity_item_comments( $parent_activity-&gt;id );
+
+                $result = BP_Activity_Activity::get( array( 'in' =&gt; wp_list_pluck( $comments, 'id' ), ) );
+                $this-&gt;assertEmpty( $result['activities'] );
+        }
+
+        /**
+         * @ticket BP4804
+         */
+        public function test_delete_activity_meta_entries() {
+                $activity = $this-&gt;factory-&gt;activity-&gt;create( array(
+                        'type' =&gt; 'activity_update',
+                ) );
+
+                bp_activity_update_meta( $activity-&gt;id, 'Paul', 'is cool' );
+                BP_Activity_Activity::delete_activity_meta_entries( $activity-&gt;id );
+
+                $meta = bp_activity_get_meta( $activity-&gt;id, 'Paul' );
+                $this-&gt;assertFalse( $meta );
+        }
+
+        public function test_hide_all_for_user() {
+                $activity = $this-&gt;factory-&gt;activity-&gt;create( array(
+                        'type' =&gt; 'activity_update',
+                ) );
+
+                BP_Activity_Activity::hide_all_for_user( get_current_user_id() );
+
+                $activity = BP_Activity_Activity::get( array(
+                        'in'          =&gt; $activity-&gt;id,
+                        'show_hidden' =&gt; true,
+                ) );
+                $this-&gt;assertEquals( $activity['activities'][0]-&gt;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>+&lt;?php
+/**
+ * @group activity
+ */
+class BP_Tests_Activity_Functions extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this-&gt;old_current_user );
+        }
+
+        /**
+         * @ticket BP4488
+         */
+        public function test_thumbnail_content_images() {
+                // No images
+                $post_content = 'foo bar';
+                $this-&gt;assertEquals( bp_activity_thumbnail_content_images( $post_content ), 'foo bar' );
+
+                // Image first, no caption. See #BP4488
+                $post_content = '&lt;img src=&quot;http://example.com/foo.jpg&quot; alt=&quot;foo&quot; width=&quot;40&quot; height=&quot;40&quot; class=&quot;alignnone size-full wp-image-236&quot; /&gt; foo bar';
+                $this-&gt;assertEquals( bp_activity_thumbnail_content_images( $post_content ), '&lt;img src=&quot;http://example.com/foo.jpg&quot; width=&quot;40&quot; height=&quot;40&quot; alt=&quot;Thumbnail&quot; class=&quot;align-left thumbnail&quot; /&gt; foo bar' );
+
+                // Image first, caption. See #BP4488
+                $post_content = '[caption id=&quot;attachment_236&quot; align=&quot;alignnone&quot; width=&quot;40&quot;]&lt;img src=&quot;http://example.com/foo.jpg&quot; alt=&quot;FOO!&quot; width=&quot;40&quot; height=&quot;40&quot; class=&quot;size-full wp-image-236&quot; /&gt; FOO![/caption] Awesome.';
+                $this-&gt;assertEquals( bp_activity_thumbnail_content_images( $post_content ), '&lt;img src=&quot;http://example.com/foo.jpg&quot; width=&quot;40&quot; height=&quot;40&quot; alt=&quot;Thumbnail&quot; class=&quot;align-left thumbnail&quot; /&gt; 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>+&lt;?php
+/**
+ * @group activity
+ */
+class BP_Tests_Activity_Template extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                $this-&gt;set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                $this-&gt;set_current_user( $this-&gt;old_current_user );
+        }
+
+        /**
+         * @ticket BP4735
+         */
+        public function test_user_can_delete() {
+                global $bp;
+
+                $activity = $this-&gt;factory-&gt;activity-&gt;create( array(
+                        'type' =&gt; 'activity_update',
+                ) );
+
+                // User can delete his own items
+                $this-&gt;assertTrue( bp_activity_user_can_delete( $activity ) );
+
+                // Stash original user
+                $original_user = get_current_user_id();
+
+                // Logged-out user can't delete
+                $this-&gt;set_current_user( 0 );
+                $this-&gt;assertFalse( bp_activity_user_can_delete( $activity ) );
+
+                // Miscellaneous user can't delete
+                $misc_user = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
+                $this-&gt;set_current_user( $misc_user );
+                $this-&gt;assertFalse( bp_activity_user_can_delete( $activity ) );
+
+                // Item admin can delete
+                $is_single_item = $bp-&gt;is_single_item;
+                $bp-&gt;is_single_item = true;
+
+                $is_item_admin = $bp-&gt;is_item_admin;
+                $bp-&gt;is_item_admin = true;
+
+                $this-&gt;assertTrue( bp_activity_user_can_delete( $activity ) );
+
+                $bp-&gt;is_single_item = $is_single_item;
+                $bp-&gt;is_item_admin = $is_item_admin;
+                $this-&gt;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>+&lt;?php
+/**
+ * @group admin
+ */
+class BP_Tests_Admin_Functions extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; '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-&gt;old_current_user );
+        }
+
+        public function test_bp_admin_list_table_current_bulk_action() {
+                $_REQUEST['action'] = 'foo';
+                $_REQUEST['action2'] = '-1';
+                $this-&gt;assertEquals( bp_admin_list_table_current_bulk_action(), 'foo' );
+
+                $_REQUEST['action'] = '-1';
+                $_REQUEST['action2'] = 'foo';
+                $this-&gt;assertEquals( bp_admin_list_table_current_bulk_action(), 'foo' );
+
+                $_REQUEST['action'] = 'bar';
+                $_REQUEST['action2'] = 'foo';
+                $this-&gt;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()-&gt;active_components;
+
+                // Standard deactivation from All screen
+                unset( $_GET['action'] );
+                buddypress()-&gt;active_components = array(
+                        'activity' =&gt; 1,
+                        'friends' =&gt; 1,
+                        'groups' =&gt; 1,
+                        'members' =&gt; 1,
+                        'messages' =&gt; 1,
+                        'settings' =&gt; 1,
+                        'xprofile' =&gt; 1,
+                );
+
+                $submitted = array(
+                        'groups' =&gt; 1,
+                        'members' =&gt; 1,
+                        'messages' =&gt; 1,
+                        'settings' =&gt; 1,
+                        'xprofile' =&gt; 1,
+                );
+
+                $this-&gt;assertEquals( bp_core_admin_get_active_components_from_submitted_settings( $submitted ), array( 'groups' =&gt; 1, 'members' =&gt; 1, 'messages' =&gt; 1, 'settings' =&gt; 1, 'xprofile' =&gt; 1 ) );
+
+                // Activating deactivated components from the Inactive screen
+                $_GET['action'] = 'inactive';
+                buddypress()-&gt;active_components = array(
+                        'activity' =&gt; 1,
+                        'members' =&gt; 1,
+                        'messages' =&gt; 1,
+                        'settings' =&gt; 1,
+                        'xprofile' =&gt; 1,
+                );
+
+                $submitted2 = array(
+                        'groups' =&gt; 1,
+                );
+
+                $this-&gt;assertEquals( bp_core_admin_get_active_components_from_submitted_settings( $submitted2 ), array( 'activity' =&gt; 1, 'groups' =&gt; 1, 'members' =&gt; 1, 'messages' =&gt; 1, 'settings' =&gt; 1, 'xprofile' =&gt; 1 ) );
+
+                // Activating from the Retired screen
+                $_GET['action'] = 'retired';
+                buddypress()-&gt;active_components = array(
+                        'activity' =&gt; 1,
+                        'members' =&gt; 1,
+                        'messages' =&gt; 1,
+                        'settings' =&gt; 1,
+                        'xprofile' =&gt; 1,
+                );
+
+                $submitted3 = array(
+                        'forums' =&gt; 1,
+                );
+
+                $this-&gt;assertEquals( bp_core_admin_get_active_components_from_submitted_settings( $submitted3 ), array( 'activity' =&gt; 1, 'forums' =&gt; 1, 'members' =&gt; 1, 'messages' =&gt; 1, 'settings' =&gt; 1, 'xprofile' =&gt; 1 ) );
+
+                // Deactivating from the Retired screen
+                $_GET['action'] = 'retired';
+                buddypress()-&gt;active_components = array(
+                        'activity' =&gt; 1,
+                        'forums' =&gt; 1,
+                        'members' =&gt; 1,
+                        'messages' =&gt; 1,
+                        'settings' =&gt; 1,
+                        'xprofile' =&gt; 1,
+                );
+
+                $submitted4 = array();
+
+                $this-&gt;assertEquals( bp_core_admin_get_active_components_from_submitted_settings( $submitted4 ), array( 'activity' =&gt; 1, 'members' =&gt; 1, 'messages' =&gt; 1, 'settings' =&gt; 1, 'xprofile' =&gt; 1 ) );
+
+                // reset
+                if ( $get_action ) {
+                        $_GET['action'] = $get_action;
+                } else {
+                        unset( $_GET['action'] );
+                }
+
+                buddypress()-&gt;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>+&lt;?php
+/**
+ * @group members
+ */
+class BP_Tests_Members_Functions extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                $this-&gt;set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                $this-&gt;set_current_user( $this-&gt;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-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; '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-&gt;set_current_user( $admin_user );
+                $user1 = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
+                bp_core_delete_account( $user1 );
+                $maybe_user = new WP_User( $user1 );
+                $this-&gt;assertEquals( 0, $maybe_user-&gt;ID );
+                unset( $maybe_user );
+
+                // 2. Admin cannot delete superadmin account
+                $user2 = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
+                bp_core_delete_account( $user2 );
+                $maybe_user = new WP_User( $user2 );
+                $this-&gt;assertNotEquals( 0, $maybe_user-&gt;ID );
+                unset( $maybe_user );
+
+                // User cannot delete other's account
+                $user3 = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
+                $user4 = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
+                $this-&gt;set_current_user( $user3 );
+                bp_core_delete_account( $user4 );
+                $maybe_user = new WP_User( $user4 );
+                $this-&gt;assertNotEquals( 0, $maybe_user-&gt;ID );
+                unset( $maybe_user );
+
+                // User cannot delete own account when account deletion is disabled
+                $user5 = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
+                $this-&gt;set_current_user( $user5 );
+                bp_update_option( 'bp-disable-account-deletion', 1 );
+                bp_core_delete_account( $user5 );
+                $maybe_user = new WP_User( $user5 );
+                $this-&gt;assertNotEquals( 0, $maybe_user-&gt;ID );
+                unset( $maybe_user );
+
+                // User can delete own account when account deletion is enabled
+                $user6 = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
+                $this-&gt;set_current_user( $user6 );
+                bp_update_option( 'bp-disable-account-deletion', 0 );
+                bp_core_delete_account( $user6 );
+                $maybe_user = new WP_User( $user6 );
+                $this-&gt;assertEquals( 0, $maybe_user-&gt;ID );
+                unset( $maybe_user );
+
+                // Cleanup
+                $this-&gt;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>+&lt;?php
+/**
+ * @group activity
+ * @group routing
+ */
+class BP_Tests_Routing_Activity extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this-&gt;old_current_user );
+        }
+
+        function test_activity_directory() {
+                $this-&gt;go_to( bp_get_activity_directory_permalink() );
+                $this-&gt;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-&gt;factory-&gt;activity-&gt;create();
+
+                $url = bp_core_get_user_domain( $activity-&gt;user_id, $activity-&gt;user_nicename, $activity-&gt;user_login ) . bp_get_activity_slug() . '/' . $activity-&gt;id . '/';
+                $this-&gt;go_to( $url );
+                $this-&gt;assertTrue( bp_is_single_activity() );
+        }
+
+        function test_member_activity() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() );
+                $this-&gt;assertTrue( bp_is_user_activity() );
+        }
+
+        function test_member_activity_mentions() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/mentions'  );
+                $this-&gt;assertTrue( bp_is_user_activity() );
+        }
+
+        function test_member_activity_favourites() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/favorites'  );
+                $this-&gt;assertTrue( bp_is_user_activity() );
+        }
+
+        /**
+         * @group friends
+         */
+        function test_member_activity_friends() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/' . bp_get_friends_slug() );
+                $this-&gt;assertTrue( bp_is_user_friends_activity() );
+        }
+
+        /**
+         * @group groups
+         */
+        function test_member_activity_groups() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/' . bp_get_groups_slug() );
+                $this-&gt;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>+&lt;?php
+/**
+ * @group routing
+ */
+class BP_Tests_Routing_Anonymous extends BP_UnitTestCase {
+
+        function test_wordpress_page() {
+                $this-&gt;go_to( '/' );
+                $this-&gt;assertEmpty( bp_current_component() );
+        }
+
+        function test_nav_menu() {
+                $this-&gt;go_to( '/' );
+                $this-&gt;assertEmpty( buddypress()-&gt;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>+&lt;?php
+/**
+ * @group core
+ * @group routing
+ */
+class BP_Tests_Routing_Core extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this-&gt;old_current_user );
+        }
+
+        function test_wordpress_page() {
+                $this-&gt;go_to( '/' );
+                $this-&gt;assertEmpty( bp_current_component() );
+        }
+
+        function test_nav_menu() {
+                $this-&gt;go_to( '/' );
+                $this-&gt;assertArrayHasKey( 'activity', buddypress()-&gt;bp_nav );
+                $this-&gt;assertArrayHasKey( 'profile',  buddypress()-&gt;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>+&lt;?php
+/**
+ * @group friends
+ * @group routing
+ */
+class BP_Tests_Routing_Friends extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this-&gt;old_current_user );
+        }
+
+        function test_member_friends() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_friends_slug() );
+                $this-&gt;assertTrue( bp_is_user_friends() );
+        }
+
+        function test_member_friends_requests() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_friends_slug()  . '/requests' );
+                $this-&gt;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>+&lt;?php
+/**
+ * @group groups
+ * @group routing
+ */
+class BP_Tests_Routing_Groups extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this-&gt;old_current_user );
+        }
+
+        function test_member_groups() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_groups_slug() );
+                $this-&gt;assertTrue( bp_is_user_groups() );
+        }
+
+        function test_member_groups_invitations() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_groups_slug() . '/invites' );
+                $this-&gt;assertTrue( bp_is_user_groups() &amp;&amp; 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>+&lt;?php
+/**
+ * @group members
+ * @group routing
+ */
+class BP_Tests_Routing_Members extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'paulgibbs', 'role' =&gt; 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this-&gt;old_current_user );
+        }
+
+        function test_members_directory() {
+                $this-&gt;go_to( bp_get_members_directory_permalink() );
+                $this-&gt;assertEquals( bp_get_members_root_slug(), bp_current_component() );
+        }
+
+        function test_member_permalink() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) );
+                $this-&gt;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>+&lt;?php
+/**
+ * @group messages
+ * @group routing
+ */
+class BP_Tests_Routing_Messages extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this-&gt;old_current_user );
+        }
+
+        function test_member_messages() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() );
+                $this-&gt;assertTrue( bp_is_messages_inbox() );
+        }
+
+        function test_member_messages_sentbox() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() . '/sentbox' );
+                $this-&gt;assertTrue( bp_is_messages_sentbox() );
+        }
+
+        function test_member_messages_compose() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() . '/compose' );
+                $this-&gt;assertTrue( bp_is_messages_compose_screen() );
+        }
+
+        function test_member_messages_notices() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() . '/notices' );
+                $this-&gt;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>+&lt;?php
+/**
+ * @group settings
+ * @group routing
+ */
+class BP_Tests_Routing_Settings extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this-&gt;old_current_user );
+        }
+
+        function test_member_settings() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() );
+                $this-&gt;assertTrue( bp_is_user_settings_general() );
+        }
+
+        function test_member_settings_notifications() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/notifications' );
+                $this-&gt;assertTrue( bp_is_user_settings_notifications() );
+        }
+
+        // @todo How best to test this?
+        /*function bp_is_user_settings_account_capbilities() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/capabilities' );
+        }*/
+
+        function bp_is_user_settings_account_delete() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/delete-account' );
+                $this-&gt;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>+&lt;?php
+/**
+ * @group xprofile
+ * @group routing
+ */
+class BP_Tests_Routing_XProfile extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this-&gt;old_current_user );
+        }
+
+        function test_member_profile() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . buddypress()-&gt;profile-&gt;slug );
+                $this-&gt;assertTrue( bp_is_user_profile() );
+        }
+
+        function test_member_profile_edit() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . buddypress()-&gt;profile-&gt;slug . '/edit' );
+                $this-&gt;assertTrue( bp_is_user_profile_edit() );
+        }
+
+        function test_member_profile_change_avatar() {
+                $this-&gt;go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . buddypress()-&gt;profile-&gt;slug . '/change-avatar' );
+                $this-&gt;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>+&lt;?php
+/**
+ * @group url
+ */
+class BP_Tests_URL extends BP_UnitTestCase {
+        protected $old_current_user = 0;
+
+        public function setUp() {
+                parent::setUp();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) ) );
+        }
+
+        public function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this-&gt;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-&gt;go_to( '/' );
+                $this-&gt;assertEquals( bp_core_ajax_url(), get_site_url( bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http' ) );
+
+                // (1b) Dashboard
+                $this-&gt;go_to( '/wp-admin' );
+                $this-&gt;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-&gt;go_to( '/' );
+                $this-&gt;assertEquals( bp_core_ajax_url(), get_site_url( bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http' ) );
+
+                // (2b) Dashboard
+                $this-&gt;go_to( '/wp-admin' );
+                $this-&gt;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-&gt;factory-&gt;blog-&gt;create();
+                        buddypress()-&gt;root_blog_id = $blog_id;
+
+                        switch_to_blog( $blog_id );
+                        $blog_details = get_blog_details();
+
+                        $this-&gt;go_to( '/' );
+                        $this-&gt;assertEquals( bp_core_ajax_url(), $blog_details-&gt;siteurl . '/wp-admin/admin-ajax.php' );
+
+                        restore_current_blog();
+                        buddypress()-&gt;root_blog_id = $original_root_blog;
+                }
+
+        }
+}
</ins></span></pre>
</div>
</div>

</body>
</html>