Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5974730
ThanksSpecialLogTest.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
ThanksSpecialLogTest.php
View Options
<?php
namespace
MediaWiki\Extension\Thanks\Tests\Integration
;
use
MediaWiki\Request\FauxRequest
;
use
MediaWiki\Specials\SpecialLog
;
use
SpecialPageTestBase
;
/**
* @covers \MediaWiki\Extension\Thanks\Hooks
* @group Database
*/
class
ThanksSpecialLogTest
extends
SpecialPageTestBase
{
public
function
testDoNotShowThanksLinkToTempUsersOnSpecialLog
()
{
// Create a logged event that can be thanked.
$this
->
editPage
(
'Test'
,
'Foo'
,
''
,
NS_MAIN
,
$this
->
getMutableTestUser
()->
getUser
()
);
$tempUser
=
$this
->
getServiceContainer
()->
getTempUserCreator
()->
create
(
'~2024-1'
,
new
FauxRequest
()
)->
getUser
();
// Load Special:Log as a temp user, check that the thanks link doesn't appear.
[
$html
]
=
$this
->
executeSpecialPage
(
''
,
new
FauxRequest
(),
null
,
$tempUser
);
$this
->
assertStringNotContainsString
(
'mw-thanks-thank-link'
,
$html
);
// Load Special:Log as an anon user, check that the thanks link doesn't appear.
[
$html
]
=
$this
->
executeSpecialPage
();
$this
->
assertStringNotContainsString
(
'mw-thanks-thank-link'
,
$html
);
// Load Special:Log as a named user, check that the thanks link does appear.
[
$html
]
=
$this
->
executeSpecialPage
(
''
,
new
FauxRequest
(),
null
,
$this
->
getMutableTestUser
()->
getUser
()
);
$this
->
assertStringContainsString
(
'mw-thanks-thank-link'
,
$html
);
}
protected
function
newSpecialPage
()
{
$services
=
$this
->
getServiceContainer
();
return
new
SpecialLog
(
$services
->
getLinkBatchFactory
(),
$services
->
getConnectionProvider
(),
$services
->
getActorNormalization
(),
$services
->
getUserIdentityLookup
(),
$services
->
getUserNameUtils
(),
$services
->
getLogFormatterFactory
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 17:40 (1 d, 6 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d6/bd/516faf1f9fee31449f5996c2b1b0
Default Alt Text
ThanksSpecialLogTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment