Skip to:
Content

bbPress.org

Changeset 5946


Ignore:
Timestamp:
10/27/2015 12:07:35 PM (4 years ago)
Author:
netweb
Message:

Users: Update $_SERVER['REMOTE_ADDR'] IP adress check to 127.0.0.1 in bbp_current_author_ip()

This changeset updates our unit tests and ensures compatability with WordPress test suite where in [WP34172] $_SERVER[ 'REMOTE_ADDR' ] is now initialised during the test bootstrap so individual tests need not.

Props thebrandonallen. See #2883.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/users/functions.php

    r5926 r5946  
    139139 * Get the poster IP address
    140140 *
    141  * @since bbPress (r3120)
     141 * @since 2.0.0 bbPress (r3120)
     142 * @since 2.6.0 bbPress (r5609) Added `empty()` check for unit tests
    142143 *
    143144 * @return string
     
    148149    $remote_address = ! empty( $_SERVER['REMOTE_ADDR'] )
    149150        ? $_SERVER['REMOTE_ADDR']
    150         : '0.0.0.0';
     151        : '127.0.0.1';
    151152
    152153    // Remove any unsavory bits
  • trunk/tests/phpunit/includes/install.php

    r5770 r5946  
    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
  • trunk/tests/phpunit/testcases/core/update.php

    r5883 r5946  
    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 ) );
     
    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 ) );
  • trunk/tests/phpunit/testcases/users/template/user.php

    r5902 r5946  
    324324        $t = $this->factory->topic->create();
    325325
    326         $author_ip = '<span class="bbp-author-ip">(0.0.0.0)</span>';
     326        $author_ip = '<span class="bbp-author-ip">(127.0.0.1)</span>';
    327327
    328328        // String.
Note: See TracChangeset for help on using the changeset viewer.