Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4100875
CookieTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
CookieTest.php
View Options
<?php
namespace
Wikimedia\Tests
;
use
Cookie
;
use
PHPUnit\Framework\TestCase
;
/**
* @covers \Cookie
*/
class
CookieTest
extends
TestCase
{
/**
* @dataProvider cookieDomains
* @covers \Cookie::validateCookieDomain
*/
public
function
testValidateCookieDomain
(
$expected
,
$domain
,
$origin
=
null
)
{
if
(
$origin
)
{
$ok
=
Cookie
::
validateCookieDomain
(
$domain
,
$origin
);
$msg
=
"$domain against origin $origin"
;
}
else
{
$ok
=
Cookie
::
validateCookieDomain
(
$domain
);
$msg
=
"$domain"
;
}
$this
->
assertEquals
(
$expected
,
$ok
,
$msg
);
}
public
static
function
cookieDomains
()
{
return
[
[
false
,
"org"
],
[
false
,
".org"
],
[
true
,
"wikipedia.org"
],
[
true
,
".wikipedia.org"
],
[
false
,
"co.uk"
],
[
false
,
".co.uk"
],
[
false
,
"gov.uk"
],
[
false
,
".gov.uk"
],
[
true
,
"supermarket.uk"
],
[
false
,
"uk"
],
[
false
,
".uk"
],
[
false
,
"127.0.0."
],
[
false
,
"127."
],
[
false
,
"127.0.0.1."
],
[
true
,
"127.0.0.1"
],
[
false
,
"333.0.0.1"
],
[
true
,
"example.com"
],
[
false
,
"example.com."
],
[
true
,
".example.com"
],
[
true
,
".example.com"
,
"www.example.com"
],
[
false
,
"example.com"
,
"www.example.com"
],
[
true
,
"127.0.0.1"
,
"127.0.0.1"
],
[
false
,
"127.0.0.1"
,
"localhost"
],
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 16:42 (3 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0a/9b/40ddffbc71ba9fd3bd7075a50a4f
Default Alt Text
CookieTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment