Skip to:
Content

bbPress.org

Ticket #2883: 2883.02.patch

File 2883.02.patch, 27.0 KB (added by thebrandonallen, 4 years ago)
  • src/includes/users/functions.php

    diff --git src/includes/users/functions.php src/includes/users/functions.php
    index 569970b..6e5396f 100644
    function bbp_current_author_ip() { 
    147147        // Check for remote address
    148148        $remote_address = ! empty( $_SERVER['REMOTE_ADDR'] )
    149149                ? $_SERVER['REMOTE_ADDR']
    150                 : '0.0.0.0';
     150                : '127.0.0.1';
    151151
    152152        // Remove any unsavory bits
    153153        $retval = preg_replace( '/[^0-9a-fA-F:., ]/', '', $remote_address );
  • tests/phpunit/includes/install.php

    diff --git tests/phpunit/includes/install.php tests/phpunit/includes/install.php
    index 09a8a16..20ec273 100644
    tests_add_filter( 'plugins_loaded', '_load_bbpress' ); 
    3131// Override some fussy global values
    3232$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
    3333$_SERVER['HTTP_HOST']       = WP_TESTS_DOMAIN;
    34 $_SERVER['REMOTE_ADDR']     = '0.0.0.0';
     34$_SERVER['REMOTE_ADDR']     = '127.0.0.1';
    3535
    3636// Fix PHP identity crisis
    3737$PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
  • tests/phpunit/includes/testcase.php

    diff --git tests/phpunit/includes/testcase.php tests/phpunit/includes/testcase.php
    index 9935978..f6b64ba 100644
    class BBP_UnitTestCase extends WP_UnitTestCase { 
    3333                if ( class_exists( 'BP_UnitTest_Factory' ) ) {
    3434                        $this->bp_factory = new BP_UnitTest_Factory();
    3535                }
     36
     37                // Our default is ugly permalinks, so reset when needed.
     38                global $wp_rewrite;
     39                if ( $wp_rewrite->permalink_structure ) {
     40                        $this->set_permalink_structure();
     41                }
    3642        }
    3743
    3844        function clean_up_global_scope() {
    class BBP_UnitTestCase extends WP_UnitTestCase { 
    340346                global $wpdb;
    341347                $wpdb->query( 'COMMIT;' );
    342348        }
     349
     350        /**
     351         * Utility method that resets permalinks and flushes rewrites.
     352         *
     353         * @since 2.6.0 bbPress (rXXXX)
     354         *
     355         * @global WP_Rewrite $wp_rewrite
     356         *
     357         * @uses WP_UnitTestCase::set_permalink_structure()
     358         *
     359         * @param string $structure Optional. Permalink structure to set. Default empty.
     360         */
     361        public function set_permalink_structure( $structure = '' ) {
     362
     363                // Use WP 4.4+'s version if it exists.
     364                if ( method_exists( 'parent', 'set_permalink_structure' ) ) {
     365                        parent::set_permalink_structure( $structure );
     366                } else {
     367                        global $wp_rewrite;
     368
     369                        $wp_rewrite->init();
     370                        $wp_rewrite->set_permalink_structure( $structure );
     371                        $wp_rewrite->flush_rules();
     372                }
     373        }
    343374}
  • tests/phpunit/testcases/core/update.php

    diff --git tests/phpunit/testcases/core/update.php tests/phpunit/testcases/core/update.php
    index b4b848c..eebb360 100644
    class BBP_Tests_Core_Update extends BBP_UnitTestCase { 
    131131                $this->assertSame( '1 day, 16 hours ago', bbp_get_forum_last_active_time( $forum_id ) );
    132132
    133133                // Topic meta
    134                 $this->assertSame( '0.0.0.0', bbp_current_author_ip( $topic_id ) );
     134                $this->assertSame( '127.0.0.1', bbp_current_author_ip( $topic_id ) );
    135135                $this->assertSame( $forum_id, bbp_get_topic_forum_id( $topic_id ) );
    136136                $this->assertSame( 1, bbp_get_topic_voice_count( $topic_id, true ) );
    137137                $this->assertSame( 1, bbp_get_topic_reply_count( $topic_id, true ) );
    class BBP_Tests_Core_Update extends BBP_UnitTestCase { 
    141141                $this->assertSame( '1 day, 16 hours ago', bbp_get_topic_last_active_time( $topic_id ) );
    142142
    143143                // Reply Meta
    144                 $this->assertSame( '0.0.0.0', bbp_current_author_ip( $reply_id ) );
     144                $this->assertSame( '127.0.0.1', bbp_current_author_ip( $reply_id ) );
    145145                $this->assertSame( $forum_id, bbp_get_reply_forum_id( $reply_id ) );
    146146                $this->assertSame( $topic_id, bbp_get_reply_topic_id( $reply_id ) );
    147147        }
  • tests/phpunit/testcases/forums/functions/forum.php

    diff --git tests/phpunit/testcases/forums/functions/forum.php tests/phpunit/testcases/forums/functions/forum.php
    index 3c3b25d..0d9d917 100644
    class BBP_Tests_Forums_Functions_Forum extends BBP_UnitTestCase { 
    1515         */
    1616        public function test_bbp_insert_forum() {
    1717
    18                 $f = $this->factory->forum->create();
     18                $f = $this->factory->forum->create( array(
     19                        'post_title' => 'Forum 1',
     20                        'post_content' => 'Content of Forum 1',
     21                ) );
    1922
    2023                $now = time();
    2124                $post_date = date( 'Y-m-d H:i:s', $now - 60 * 60 * 100 );
  • tests/phpunit/testcases/forums/functions/query.php

    diff --git tests/phpunit/testcases/forums/functions/query.php tests/phpunit/testcases/forums/functions/query.php
    index e711291..bbc0eb0 100644
    class BBP_Tests_Forums_Functions_Query extends BBP_UnitTestCase { 
    4747                        ),
    4848                ) );
    4949
    50                 $this->assertEquals( array( $t1, $t2, $t3 ), bbp_forum_query_topic_ids( $f ) );
     50                $this->assertEqualSets( array( $t1, $t2, $t3 ), bbp_forum_query_topic_ids( $f ) );
    5151        }
    5252
    5353        /**
    class BBP_Tests_Forums_Functions_Query extends BBP_UnitTestCase { 
    6464                        'post_parent' => $f1,
    6565                ) );
    6666
    67                 $this->assertEquals( array( $f2, $f3 ), bbp_forum_query_subforum_ids( $f1 ) );
     67                $this->assertEqualSets( array( $f2, $f3 ), bbp_forum_query_subforum_ids( $f1 ) );
    6868        }
    6969
    7070        /**
  • tests/phpunit/testcases/forums/template/feeds.php

    diff --git tests/phpunit/testcases/forums/template/feeds.php tests/phpunit/testcases/forums/template/feeds.php
    index c51e351..acf06ab 100644
    class BBP_Tests_Forums_Template_Feeds extends BBP_UnitTestCase { 
    1919                        $this->markTestSkipped( 'Skipping URL tests in multiste for now.' );
    2020                }
    2121
    22                 $f = $this->factory->forum->create();
     22                $f = $this->factory->forum->create( array(
     23                        'post_title' => 'Forum 1',
     24                ) );
    2325
    2426                $feed_link = bbp_get_forum_topics_feed_link( $f );
    2527                $this->expectOutputString( $feed_link );
    class BBP_Tests_Forums_Template_Feeds extends BBP_UnitTestCase { 
    3941                        $this->markTestSkipped( 'Skipping URL tests in multiste for now.' );
    4042                }
    4143
    42                 $f = $this->factory->forum->create();
     44                $f = $this->factory->forum->create( array(
     45                        'post_title' => 'Forum 1',
     46                ) );
    4347
    4448                $feed_link = bbp_get_forum_replies_feed_link( $f );
    4549                $this->expectOutputString( $feed_link );
  • tests/phpunit/testcases/forums/template/forum.php

    diff --git tests/phpunit/testcases/forums/template/forum.php tests/phpunit/testcases/forums/template/forum.php
    index 5b6982f..79f6ccf 100644
    class BBP_Tests_Forums_Template_Forum extends BBP_UnitTestCase { 
    4141                        $this->markTestSkipped( 'Skipping URL tests in multiste for now.' );
    4242                }
    4343
    44                 $f = $this->factory->forum->create();
     44                $f = $this->factory->forum->create( array(
     45                        'post_title' => 'Forum 1',
     46                ) );
    4547
    4648                $forum_permalink = bbp_get_forum_permalink( $f );
    4749                $this->expectOutputString( $forum_permalink );
    class BBP_Tests_Forums_Template_Forum extends BBP_UnitTestCase { 
    5658         * @covers ::bbp_get_forum_title
    5759         */
    5860        public function test_bbp_get_forum_title() {
    59                 $f = $this->factory->forum->create();
     61                $f = $this->factory->forum->create( array(
     62                        'post_title' => 'Forum 1',
     63                ) );
    6064
    6165                $forum = bbp_get_forum_title( $f );
    6266                $this->assertSame( 'Forum 1', $forum );
    class BBP_Tests_Forums_Template_Forum extends BBP_UnitTestCase { 
    8084         * @covers ::bbp_get_forum_content
    8185         */
    8286        public function test_bbp_get_forum_content() {
    83                 $f = $this->factory->forum->create();
     87                $f = $this->factory->forum->create( array(
     88                        'post_content' => 'Content of Forum 1',
     89                ) );
    8490
    8591                $forum = bbp_get_forum_content( $f );
    8692                $this->assertSame( 'Content of Forum 1', $forum );
    class BBP_Tests_Forums_Template_Forum extends BBP_UnitTestCase { 
    105111                $this->assertSame( 'No Topics', $fresh_link );
    106112
    107113                $t = $this->factory->topic->create( array(
     114                        'post_title' => 'Topic 1',
    108115                        'post_parent' => $f,
    109116                        'post_date' => $post_date,
    110117                        'topic_meta' => array(
    class BBP_Tests_Forums_Template_Forum extends BBP_UnitTestCase { 
    138145                $this->assertSame( 'No Topics', $link );
    139146
    140147                $t1 = $this->factory->topic->create( array(
     148                        'post_title' => 'Topic 1',
    141149                        'post_parent' => $f,
    142150                        'post_date' => $post_date_t1,
    143151                        'topic_meta' => array(
    class BBP_Tests_Forums_Template_Forum extends BBP_UnitTestCase { 
    149157                $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1" title="Topic 1">18 hours ago</a>', $link );
    150158
    151159                $t2 = $this->factory->topic->create( array(
     160                        'post_title' => 'Topic 2',
    152161                        'post_parent' => $f,
    153162                        'post_date' => $post_date_t2,
    154163                        'topic_meta' => array(
    class BBP_Tests_Forums_Template_Forum extends BBP_UnitTestCase { 
    165174                $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1" title="Topic 1">18 hours ago</a>', $link );
    166175
    167176                $t3 = $this->factory->topic->create( array(
     177                        'post_title' => 'Topic 3',
    168178                        'post_parent' => $f,
    169179                        'post_date' => $post_date_t3,
    170180                        'topic_meta' => array(
    class BBP_Tests_Forums_Template_Forum extends BBP_UnitTestCase { 
    182192                $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1" title="Topic 1">18 hours ago</a>', $link );
    183193
    184194                $t4 = $this->factory->topic->create( array(
     195                        'post_title' => 'Topic 4',
    185196                        'post_parent' => $f,
    186197                        'post_date' => $post_date_t4,
    187198                        'topic_meta' => array(
    class BBP_Tests_Forums_Template_Forum extends BBP_UnitTestCase { 
    214225                $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-4" title="Topic 4">12 hours ago</a>', $link );
    215226
    216227                $t5 = $this->factory->topic->create( array(
     228                        'post_title' => 'Topic 5',
    217229                        'post_parent' => $f,
    218230                        'post_date' => $post_date_t5,
    219231                        'topic_meta' => array(
  • tests/phpunit/testcases/forums/template/get-last-thing.php

    diff --git tests/phpunit/testcases/forums/template/get-last-thing.php tests/phpunit/testcases/forums/template/get-last-thing.php
    index d68284b..15bccda 100644
    class BBP_Tests_Forums_Template_Forum_Last_Thing extends BBP_UnitTestCase { 
    186186                $f = $this->factory->forum->create();
    187187
    188188                $t = $this->factory->topic->create( array(
     189                        'post_title' => 'Topic 1',
    189190                        'post_parent' => $f,
    190191                        'topic_meta' => array(
    191192                                'forum_id' => $f,
    class BBP_Tests_Forums_Template_Forum_Last_Thing extends BBP_UnitTestCase { 
    339340                ) );
    340341
    341342                $this->factory->reply->create( array(
     343                        'post_title' => 'Reply To: Topic 1',
    342344                        'post_parent' => $t,
    343345                        'reply_meta' => array(
    344346                                'forum_id' => $f,
  • tests/phpunit/testcases/replies/functions/reply.php

    diff --git tests/phpunit/testcases/replies/functions/reply.php tests/phpunit/testcases/replies/functions/reply.php
    index edf2917..caadaed 100644
    class BBP_Tests_Replies_Functions_Reply extends BBP_UnitTestCase { 
    2525                ) );
    2626
    2727                $r = $this->factory->reply->create( array(
     28                        'post_title' => 'Reply To: Topic 1',
     29                        'post_content' => 'Content of reply to Topic 1',
    2830                        'post_parent' => $t,
    2931                        'reply_meta' => array(
    3032                                'forum_id' => $f,
    class BBP_Tests_Replies_Functions_Reply extends BBP_UnitTestCase { 
    3537                // Get the reply.
    3638                $reply = bbp_get_reply( $r );
    3739
     40                remove_all_filters( 'bbp_get_reply_content' );
     41
    3842                // Reply post.
    3943                $this->assertSame( 'Reply To: Topic 1', bbp_get_reply_title( $r ) );
     44                $this->assertSame( 'Content of reply to Topic 1', bbp_get_reply_content( $r ) );
    4045                $this->assertSame( 'publish', bbp_get_reply_status( $r ) );
    4146                $this->assertSame( $t, wp_get_post_parent_id( $r ) );
    4247                $this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/?reply=' . $reply->post_name, $reply->guid );
  • tests/phpunit/testcases/replies/template/reply.php

    diff --git tests/phpunit/testcases/replies/template/reply.php tests/phpunit/testcases/replies/template/reply.php
    index 6c787ec..828dbff 100644
    class BBP_Tests_Replies_Template_Reply extends BBP_UnitTestCase { 
    260260                ) );
    261261
    262262                $r = $this->factory->reply->create( array(
     263                        'post_content' => 'Content of Reply 1',
    263264                        'post_parent' => $t,
    264265                        'reply_meta' => array(
    265266                                'forum_id' => $f,
  • tests/phpunit/testcases/topics/functions/topic.php

    diff --git tests/phpunit/testcases/topics/functions/topic.php tests/phpunit/testcases/topics/functions/topic.php
    index 0e640a8..5b191fb 100644
    class BBP_Tests_Topics_Functions_Topic extends BBP_UnitTestCase { 
    2121                $post_date = date( 'Y-m-d H:i:s', $now - 60 * 60 * 100 );
    2222
    2323                $t = $this->factory->topic->create( array(
     24                        'post_title' => 'Topic 1',
     25                        'post_content' => 'Content for Topic 1',
    2426                        'post_parent' => $f,
    2527                        'post_date' => $post_date,
    2628                        'topic_meta' => array(
    class BBP_Tests_Topics_Functions_Topic extends BBP_UnitTestCase { 
    4042                // Get the topic.
    4143                $topic = bbp_get_topic( $t );
    4244
     45                remove_all_filters( 'bbp_get_topic_content' );
     46
    4347                // Topic post.
    4448                $this->assertSame( 'Topic 1', bbp_get_topic_title( $t ) );
     49                $this->assertSame( 'Content for Topic 1', bbp_get_topic_content( $t ) );
    4550                $this->assertSame( 'publish', bbp_get_topic_status( $t ) );
    4651                $this->assertSame( $f, wp_get_post_parent_id( $t ) );
    4752                $this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/?topic=' . $topic->post_name, $topic->guid );
  • tests/phpunit/testcases/topics/template/links.php

    diff --git tests/phpunit/testcases/topics/template/links.php tests/phpunit/testcases/topics/template/links.php
    index c001b09..a3e7f5b 100644
    class BBP_Tests_Topics_Template_Links extends BBP_UnitTestCase { 
    5050
    5151                $f = $this->factory->forum->create();
    5252                $t = $this->factory->topic->create( array(
     53                        'post_title' => 'Topic 1',
    5354                        'post_parent' => $f,
    5455                        'post_date' => $post_date,
    5556                        'topic_meta' => array(
    class BBP_Tests_Topics_Template_Links extends BBP_UnitTestCase { 
    104105
    105106                $f = $this->factory->forum->create();
    106107                $t = $this->factory->topic->create( array(
     108                        'post_title' => 'Topic 1',
    107109                        'post_parent' => $f,
    108110                        'post_date' => $post_date,
    109111                        'topic_meta' => array(
  • tests/phpunit/testcases/topics/template/topic.php

    diff --git tests/phpunit/testcases/topics/template/topic.php tests/phpunit/testcases/topics/template/topic.php
    index 20ff26f..7e8752b 100644
    class BBP_Tests_Topics_Template_Topic extends BBP_UnitTestCase { 
    5757                }
    5858                $f = $this->factory->forum->create();
    5959                $t = $this->factory->topic->create( array(
     60                        'post_title' => 'Topic 1',
    6061                        'post_parent' => $f,
    6162                        'topic_meta' => array(
    6263                                'forum_id' => $f,
    class BBP_Tests_Topics_Template_Topic extends BBP_UnitTestCase { 
    7879        public function test_bbp_get_topic_title() {
    7980                $f = $this->factory->forum->create();
    8081                $t = $this->factory->topic->create( array(
     82                        'post_title' => 'Topic 1',
    8183                        'post_parent' => $f,
    8284                        'topic_meta' => array(
    8385                                'forum_id' => $f,
    class BBP_Tests_Topics_Template_Topic extends BBP_UnitTestCase { 
    107109        public function test_bbp_get_topic_content() {
    108110                $f = $this->factory->forum->create();
    109111                $t = $this->factory->topic->create( array(
     112                        'post_content' => 'Content of Topic 1',
    110113                        'post_parent' => $f,
    111114                        'topic_meta' => array(
    112115                                'forum_id' => $f,
  • tests/phpunit/testcases/users/template/user.php

    diff --git tests/phpunit/testcases/users/template/user.php tests/phpunit/testcases/users/template/user.php
    index ea400ee..8a93cde 100644
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    2424                $this->set_current_user( $this->old_current_user );
    2525        }
    2626
    27         private function set_permalink_structure( $permalink_structure = '/%year%/%monthnum%/%day%/%postname%/' ) {
    28                 global $wp_rewrite;
    29                 $wp_rewrite->set_permalink_structure( $permalink_structure );
    30         }
    31 
    3227        /**
    3328         * @covers ::bbp_user_id
    3429         * @covers ::bbp_get_user_id
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    129124                $display_name = $this->keymaster_userdata->display_name;
    130125
    131126                // Pretty permalinks
    132                 $this->set_permalink_structure();
     127                $this->set_permalink_structure( '/%postname%/' );
    133128
    134129                $profile_link      = '<a href="http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/" rel="nofollow">' . $display_name . '</a>';
    135130                $user_profile_link = bbp_get_user_profile_link( $this->keymaster_id );
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    144139                ob_clean();
    145140
    146141                // Ugly permalinks
    147                 $this->set_permalink_structure( '' );
     142                $this->set_permalink_structure();
    148143
    149144                $profile_link      = '<a href="http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '" rel="nofollow">' . $display_name . '</a>';
    150145                $user_profile_link = bbp_get_user_profile_link( $this->keymaster_id );
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    179174        public function test_bbp_get_user_profile_url() {
    180175
    181176                // Pretty permalinks
    182                 $this->set_permalink_structure();
     177                $this->set_permalink_structure( '/%postname%/' );
    183178                $profile_url      = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/';
    184179                $user_profile_url = bbp_get_user_profile_url( $this->keymaster_id );
    185180
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    193188                ob_clean();
    194189
    195190                // Ugly permalinks
    196                 $this->set_permalink_structure( '' );
     191                $this->set_permalink_structure();
    197192
    198193                $profile_url      = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id;
    199194                $user_profile_url = bbp_get_user_profile_url( $this->keymaster_id );
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    214209                $display_name = $this->keymaster_userdata->display_name;
    215210
    216211                // Pretty permalinks
    217                 $this->set_permalink_structure();
     212                $this->set_permalink_structure( '/%postname%/' );
    218213                $profile_edit_link      = '<a href="http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/edit/" rel="nofollow">' . $display_name . '</a>';
    219214                $user_profile_edit_link = bbp_get_user_profile_edit_link( $this->keymaster_id );
    220215
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    228223                ob_clean();
    229224
    230225                // Ugly permalinks
    231                 $this->set_permalink_structure( '' );
     226                $this->set_permalink_structure();
    232227                $profile_edit_link      = '<a href="http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&#038;edit=1" rel="nofollow">' . $display_name . '</a>';
    233228                $user_profile_edit_link = bbp_get_user_profile_edit_link( $this->keymaster_id );
    234229
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    246241        public function test_bbp_user_profile_edit_url() {
    247242
    248243                // Pretty permalinks
    249                 $this->set_permalink_structure();
     244                $this->set_permalink_structure( '/%postname%/' );
    250245                $profile_edit_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/edit/';
    251246
    252247                // Output.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    256251                ob_clean();
    257252
    258253                // Ugly permalinks
    259                 $this->set_permalink_structure( '' );
     254                $this->set_permalink_structure();
    260255                $profile_edit_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&#038;edit=1';
    261256
    262257                // Output.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    270265        public function test_bbp_get_user_profile_edit_url() {
    271266
    272267                // Pretty permalinks
    273                 $this->set_permalink_structure();
     268                $this->set_permalink_structure( '/%postname%/' );
    274269                $profile_edit_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/edit/';
    275270
    276271                // String.
    277272                $this->assertSame( $profile_edit_url, bbp_get_user_profile_edit_url( $this->keymaster_id ) );
    278273
    279274                // Ugly permalinks
    280                 $this->set_permalink_structure( '' );
     275                $this->set_permalink_structure();
    281276                $profile_edit_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&edit=1';
    282277
    283278                // String.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    323318        public function test_bbp_get_author_ip() {
    324319                $t = $this->factory->topic->create();
    325320
    326                 $author_ip = '<span class="bbp-author-ip">(0.0.0.0)</span>';
     321                $author_ip = '<span class="bbp-author-ip">(127.0.0.1)</span>';
    327322
    328323                // String.
    329324                $this->assertSame( $author_ip, bbp_get_author_ip( $t ) );
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    375370        public function test_bbp_favorites_permalink() {
    376371
    377372                // Pretty permalinks
    378                 $this->set_permalink_structure();
     373                $this->set_permalink_structure( '/%postname%/' );
    379374                $favorites_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/favorites/';
    380375
    381376                // Output.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    385380                ob_clean();
    386381
    387382                // Ugly permalinks
    388                 $this->set_permalink_structure( '' );
     383                $this->set_permalink_structure();
    389384                $favorites_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&#038;bbp_favs=favorites';
    390385
    391386                // Output.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    399394        public function test_bbp_get_favorites_permalink() {
    400395
    401396                // Pretty permalinks
    402                 $this->set_permalink_structure();
     397                $this->set_permalink_structure( '/%postname%/' );
    403398                $favorites_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/favorites/';
    404399
    405400                // String.
    406401                $this->assertSame( $favorites_url, bbp_get_favorites_permalink( $this->keymaster_id ) );
    407402
    408403                // Ugly permalinks
    409                 $this->set_permalink_structure( '' );
     404                $this->set_permalink_structure();
    410405                $favorites_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&bbp_favs=favorites';
    411406
    412407                // String.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    431426        public function test_bbp_subscriptions_permalink() {
    432427
    433428                // Pretty permalinks
    434                 $this->set_permalink_structure();
     429                $this->set_permalink_structure( '/%postname%/' );
    435430                $subscriptions_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/subscriptions/';
    436431
    437432                // Output.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    441436                ob_clean();
    442437
    443438                // Ugly permalinks
    444                 $this->set_permalink_structure( '' );
     439                $this->set_permalink_structure();
    445440                $subscriptions_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&#038;bbp_subs=subscriptions';
    446441
    447442                // Output.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    455450        public function test_bbp_get_subscriptions_permalink() {
    456451
    457452                // Pretty permalinks
    458                 $this->set_permalink_structure();
     453                $this->set_permalink_structure( '/%postname%/' );
    459454                $subscriptions_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/subscriptions/';
    460455
    461456                // String.
    462457                $this->assertSame( $subscriptions_url, bbp_get_subscriptions_permalink( $this->keymaster_id ) );
    463458
    464459                // Ugly permalinks
    465                 $this->set_permalink_structure( '' );
     460                $this->set_permalink_structure();
    466461                $subscriptions_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&bbp_subs=subscriptions';
    467462
    468463                // String.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    564559        public function test_bbp_user_topics_created_url() {
    565560
    566561                // Pretty permalinks
    567                 $this->set_permalink_structure();
     562                $this->set_permalink_structure( '/%postname%/' );
    568563                $topics_created_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/topics/';
    569564
    570565                // Output.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    574569                ob_clean();
    575570
    576571                // Ugly permalinks
    577                 $this->set_permalink_structure( '' );
     572                $this->set_permalink_structure();
    578573                $topics_created_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&#038;bbp_tops=1';
    579574
    580575                // Output.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    588583        public function test_bbp_get_user_topics_created_url() {
    589584
    590585                // Pretty permalinks
    591                 $this->set_permalink_structure();
     586                $this->set_permalink_structure( '/%postname%/' );
    592587                $topics_created_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/topics/';
    593588
    594589                // String.
    595590                $this->assertSame( $topics_created_url, bbp_get_user_topics_created_url( $this->keymaster_id ) );
    596591
    597592                // Ugly permalinks
    598                 $this->set_permalink_structure( '' );
     593                $this->set_permalink_structure();
    599594                $topics_created_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&bbp_tops=1';
    600595
    601596                // String.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    608603        public function test_bbp_user_replies_created_url() {
    609604
    610605                // Pretty permalinks
    611                 $this->set_permalink_structure();
     606                $this->set_permalink_structure( '/%postname%/' );
    612607                $replies_created_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/replies/';
    613608
    614609                // Output.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    618613                ob_clean();
    619614
    620615                // Ugly permalinks
    621                 $this->set_permalink_structure( '' );
     616                $this->set_permalink_structure();
    622617                $replies_created_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user='. $this->keymaster_id . '&#038;bbp_reps=1';
    623618
    624619                // Output.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    632627        public function test_bbp_get_user_replies_created_url() {
    633628
    634629                // Pretty permalinks
    635                 $this->set_permalink_structure();
     630                $this->set_permalink_structure( '/%postname%/' );
    636631                $replies_created_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/replies/';
    637632
    638633                // String.
    639634                $this->assertSame( $replies_created_url, bbp_get_user_replies_created_url( $this->keymaster_id ) );
    640635
    641636                // Ugly permalinks
    642                 $this->set_permalink_structure( '' );
     637                $this->set_permalink_structure();
    643638                $replies_created_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user='. $this->keymaster_id . '&bbp_reps=1';
    644639
    645640                // String.
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    714709                $wp_avatar = get_avatar( $current_user, $size );
    715710
    716711                // Pretty permalinks
    717                 $this->set_permalink_structure();
     712                $this->set_permalink_structure( '/%postname%/' );
    718713                $author_link = '<a href="http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/" title="View ' . $display_name .
    719714                        '&#039;s profile" class="bbp-author-avatar" rel="nofollow">' . $wp_avatar .
    720715                        '</a>&nbsp;<a href="http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/" title="View ' . $display_name .
    class BBP_Tests_Users_Template_User extends BBP_UnitTestCase { 
    730725                ob_clean();
    731726
    732727                // Ugly permalinks
    733                 $this->set_permalink_structure( '' );
     728                $this->set_permalink_structure();
    734729                $author_link = '<a href="http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '" title="View ' . $display_name .
    735730                        '&#039;s profile" class="bbp-author-avatar" rel="nofollow">' . $wp_avatar .
    736731                        '</a>&nbsp;<a href="http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '" title="View ' . $display_name .