Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F14040277
RequestTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
858 B
Referenced Files
None
Subscribers
None
RequestTest.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Keruald\OmniTools\Tests\HTTP\Requests
;
use
Keruald\OmniTools\HTTP\Requests\Request
;
use
PHPUnit\Framework\TestCase
;
class
RequestTest
extends
TestCase
{
/**
* @covers \Keruald\OmniTools\HTTP\Requests\Request::getRemoteAddress
* @backupGlobals enabled
*/
public
function
testGetRemoteAddress
()
:
void
{
$this
->
assertEmpty
(
Request
::
getRemoteAddress
());
$_SERVER
=
[
'REMOTE_ADDR'
=>
'10.0.0.2'
,
];
$this
->
assertEquals
(
'10.0.0.2'
,
Request
::
getRemoteAddress
());
$_SERVER
+=
[
'HTTP_X_FORWARDED_FOR'
=>
'10.0.0.3'
,
'HTTP_CLIENT_IP'
=>
'10.0.0.4'
,
];
$this
->
assertEquals
(
'10.0.0.3'
,
Request
::
getRemoteAddress
(),
"HTTP_X_FORWARDED_FOR must be prioritized."
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 28, 17:40 (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3172752
Default Alt Text
RequestTest.php (858 B)
Attached To
Mode
rKOT Keruald OmniTools
Attached
Detach File
Event Timeline
Log In to Comment