Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7454572
FeatureShutdownTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
FeatureShutdownTest.php
View Options
<?php
/**
* @license GPL-2.0-or-later
* @file
*/
use
MediaWiki\Config\ServiceOptions
;
use
MediaWiki\FeatureShutdown
;
/**
* @covers \MediaWiki\FeatureShutdown
* @author Taavi Väänänen <hi@taavi.wtf>
*/
class
FeatureShutdownTest
extends
MediaWikiUnitTestCase
{
public
function
testConstruct
()
{
$this
->
assertInstanceOf
(
FeatureShutdown
::
class
,
new
FeatureShutdown
(
new
ServiceOptions
(
FeatureShutdown
::
CONSTRUCTOR_OPTIONS
,
[
'FeatureShutdown'
=>
[],
]
)
)
);
}
/**
* @dataProvider provideNotShutdown
*/
public
function
testNotShutdown
(
array
$shutdowns
)
{
$fs
=
new
FeatureShutdown
(
new
ServiceOptions
(
FeatureShutdown
::
CONSTRUCTOR_OPTIONS
,
[
'FeatureShutdown'
=>
$shutdowns
,
]
)
);
$this
->
assertNull
(
$fs
->
findForFeature
(
'legacy-bars'
)
);
}
public
static
function
provideNotShutdown
():
array
{
// reminder: each test case contains a name and an array of parameters,
// so the only parameter is an array but needs to be wrapped in another array
return
[
'Empty'
=>
[
[]
],
'Other feature configured'
=>
[
[
'legacy-foos'
=>
[
[
'start'
=>
date
(
'Y-m-d H:i:s'
,
strtotime
(
'-1 week'
)
),
'end'
=>
date
(
'Y-m-d H:i:s'
,
strtotime
(
'+1 week'
)
),
],
],
],
],
'Configured but empty'
=>
[
[
'legacy-bars'
=>
[],
],
],
'Configured but wrong time'
=>
[
[
'legacy-bars'
=>
[
[
// Assuming those timestamps are long past
'start'
=>
'2016-01-01T00:00 +00:00'
,
'end'
=>
'2016-02-01T00:00 +00:00'
,
],
],
],
],
];
}
public
function
testShutdown
()
{
$shutdown
=
[
'start'
=>
date
(
'Y-m-d H:i:s'
,
strtotime
(
'-1 week'
)
),
'end'
=>
date
(
'Y-m-d H:i:s'
,
strtotime
(
'+1 week'
)
),
];
$fs
=
new
FeatureShutdown
(
new
ServiceOptions
(
FeatureShutdown
::
CONSTRUCTOR_OPTIONS
,
[
'FeatureShutdown'
=>
[
'legacy-bars'
=>
[
$shutdown
],
],
]
)
);
$this
->
assertEquals
(
$shutdown
,
$fs
->
findForFeature
(
'legacy-bars'
)
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 23:19 (3 d, 10 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
56/c9/cf15af472f0e6c217f519c7ec485
Default Alt Text
FeatureShutdownTest.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment