| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Extension\Thanks\Tests\Integration; |
| 4 |
|
| 5 |
use MediaWiki\Request\FauxRequest; |
| 6 |
use MediaWiki\Specials\SpecialLog; |
| 7 |
use SpecialPageTestBase; |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
class ThanksSpecialLogTest extends SpecialPageTestBase { |
| 14 |
|
| 15 |
public function testDoNotShowThanksLinkToTempUsersOnSpecialLog() { |
| 16 |
|
| 17 |
$this->editPage( 'Test', 'Foo', '', NS_MAIN, $this->getMutableTestUser()->getUser() ); |
| 18 |
$tempUser = $this->getServiceContainer()->getTempUserCreator()->create( |
| 19 |
'~2024-1', new FauxRequest() |
| 20 |
)->getUser(); |
| 21 |
|
| 22 |
[ $html ] = $this->executeSpecialPage( |
| 23 |
'', |
| 24 |
new FauxRequest(), |
| 25 |
null, |
| 26 |
$tempUser |
| 27 |
); |
| 28 |
$this->assertStringNotContainsString( 'mw-thanks-thank-link', $html ); |
| 29 |
|
| 30 |
[ $html ] = $this->executeSpecialPage(); |
| 31 |
$this->assertStringNotContainsString( 'mw-thanks-thank-link', $html ); |
| 32 |
|
| 33 |
[ $html ] = $this->executeSpecialPage( |
| 34 |
'', |
| 35 |
new FauxRequest(), |
| 36 |
null, |
| 37 |
$this->getMutableTestUser()->getUser() |
| 38 |
); |
| 39 |
$this->assertStringContainsString( 'mw-thanks-thank-link', $html ); |
| 40 |
} |
| 41 |
|
| 42 |
protected function newSpecialPage() { |
| 43 |
$services = $this->getServiceContainer(); |
| 44 |
return new SpecialLog( |
| 45 |
$services->getLinkBatchFactory(), |
| 46 |
$services->getConnectionProvider(), |
| 47 |
$services->getActorNormalization(), |
| 48 |
$services->getUserIdentityLookup(), |
| 49 |
$services->getUserNameUtils(), |
| 50 |
$services->getLogFormatterFactory() |
| 51 |
); |
| 52 |
} |
| 53 |
} |