Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5982535
SpecialLogTest.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
SpecialLogTest.php
View Options
<?php
/**
* @license GPL-2.0-or-later
* @author Legoktm
*/
use
MediaWiki\Context\DerivativeContext
;
use
MediaWiki\Context\RequestContext
;
use
MediaWiki\Request\FauxRequest
;
use
MediaWiki\Revision\RevisionRecord
;
use
MediaWiki\SpecialPage\SpecialPage
;
use
MediaWiki\Specials\SpecialLog
;
/**
* @group Database
* @covers \MediaWiki\Specials\SpecialLog
*/
class
SpecialLogTest
extends
SpecialPageTestBase
{
/**
* Returns a new instance of the special page under test.
*
* @return SpecialPage
*/
protected
function
newSpecialPage
()
{
$services
=
$this
->
getServiceContainer
();
return
new
SpecialLog
(
$services
->
getLinkBatchFactory
(),
$services
->
getConnectionProvider
(),
$services
->
getActorNormalization
(),
$services
->
getUserIdentityLookup
(),
$services
->
getUserNameUtils
(),
$services
->
getLogFormatterFactory
()
);
}
/**
* Verify that no exception was thrown for an invalid date
* @see T201411
*/
public
function
testInvalidDate
()
{
[
$html
,
]
=
$this
->
executeSpecialPage
(
''
,
// There is no 13th month
new
FauxRequest
(
[
'wpdate'
=>
'2018-13-01'
]
),
'qqx'
);
$this
->
assertStringContainsString
(
'(log-summary)'
,
$html
);
}
public
function
testSuppressionLog
()
{
// Have "BadGuy" create a revision
$user
=
(
new
TestUser
(
'BadGuy'
)
)->
getUser
();
$title
=
$this
->
insertPage
(
'Foo'
,
'Bar'
,
null
,
$user
)[
'title'
];
$revId
=
$title
->
getLatestRevID
();
$context
=
new
DerivativeContext
(
RequestContext
::
getMain
()
);
$context
->
setUser
(
$this
->
getTestUser
(
[
'sysop'
,
'suppress'
]
)->
getUser
()
);
// Hide our revision's comment
$list
=
RevisionDeleter
::
createList
(
'revision'
,
$context
,
$title
,
[
$revId
]
);
$status
=
$list
->
setVisibility
(
[
'value'
=>
[
RevisionRecord
::
DELETED_RESTRICTED
=>
1
,
RevisionRecord
::
DELETED_COMMENT
=>
1
],
'comment'
=>
'SpecialLogTest'
]
);
$this
->
assertStatusGood
(
$status
);
// Allow everyone to read the suppression log
$this
->
mergeMwGlobalArrayValue
(
'wgGroupPermissions'
,
[
'*'
=>
[
'suppressionlog'
=>
true
]
]
);
[
$html
,
]
=
$this
->
executeSpecialPage
(
'suppress'
,
new
FauxRequest
(
[
'offender'
=>
'BadGuy'
]
),
'qqx'
);
$this
->
assertStringNotContainsString
(
'(logempty)'
,
$html
);
$this
->
assertStringContainsString
(
'(logentry-suppress-revision'
,
$html
);
// Full suppression log
[
$html
,
]
=
$this
->
executeSpecialPage
(
'suppress'
,
new
FauxRequest
(),
'qqx'
);
$this
->
assertStringNotContainsString
(
'(logempty)'
,
$html
);
$this
->
assertStringContainsString
(
'(logentry-suppress-revision'
,
$html
);
// Suppression log for unknown user should be empty
[
$html
,
]
=
$this
->
executeSpecialPage
(
'suppress'
,
new
FauxRequest
(
[
'offender'
=>
'GoodGuy'
]
),
'qqx'
);
$this
->
assertStringContainsString
(
'(logempty)'
,
$html
);
$this
->
assertStringNotContainsString
(
'(logentry-suppress-revision'
,
$html
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 22:24 (1 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e3/a0/676144f4b376b37341370aab7de1
Default Alt Text
SpecialLogTest.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment