Tests for wfGetIP() follow up r89407
authorAntoine Musso <hashar@users.mediawiki.org>
Tue, 16 Aug 2011 14:15:07 +0000 (14:15 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Tue, 16 Aug 2011 14:15:07 +0000 (14:15 +0000)
commitab0ebed3fd7f56a4d4688e7f2b4dc7f906c8f574
tree1aacc79a39cdaa901f1becb3eee2824bd70154f0
parentf764c6fab3b25e226ff2b47edbf6ad1dd5b8e8b0
Tests for wfGetIP() follow up r89407

* wfGetIP() now support resetting its internal static variable. Thanks to
Platonides which introduced this trick with r92960.
* Various tests for $_SERVER['REMOTE_ADDR'] and $wgCommandLineMode.

revert r94575:
 - reenable testGetFromServerRemoteAddr() which was not an issue

reintroduce r94558:
 - per CR on r94558 by Aaron use meaningful parameter to wfGetIP() when
   resetting the static variable ( 'reset' instead of true).
 - keep testLackOfRemoteAddrThrowAnException() test in the broken group
   with a comment for later fixing.

TODO:

- implements tests for XFF headers.

TEST PLAN:

$ ./phpunit.php --filter wfGetIP --testdox
PHPUnit 3.5.14 by Sebastian Bergmann.

wfGetIP
[x] Get loopback address when in command line
[x] Get from server remote addr
[x] Lack of remote addr throw an exception
$
includes/ProxyTools.php
tests/phpunit/includes/ProxyTools/wfGetIPTest.php