| 1 |
<?php |
| 2 |
|
| 3 |
use MediaWiki\SpecialPage\SpecialPage; |
| 4 |
use MediaWiki\Specials\SpecialEditWatchlist; |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
class SpecialEditWatchlistTest extends SpecialPageTestBase { |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
protected function newSpecialPage() { |
| 21 |
$services = $this->getServiceContainer(); |
| 22 |
return new SpecialEditWatchlist( |
| 23 |
$services->getWatchedItemStore(), |
| 24 |
$services->getTitleParser(), |
| 25 |
$services->getGenderCache(), |
| 26 |
$services->getLinkBatchFactory(), |
| 27 |
$services->getNamespaceInfo(), |
| 28 |
$services->getWikiPageFactory(), |
| 29 |
$services->getWatchlistManager() |
| 30 |
); |
| 31 |
} |
| 32 |
|
| 33 |
public function testNotLoggedIn_throwsException() { |
| 34 |
$this->expectException( UserNotLoggedIn::class ); |
| 35 |
$this->executeSpecialPage(); |
| 36 |
} |
| 37 |
|
| 38 |
public function testRootPage_displaysExplanationMessage() { |
| 39 |
$user = new TestUser( __METHOD__ ); |
| 40 |
[ $html, ] = $this->executeSpecialPage( '', null, 'qqx', $user->getUser() ); |
| 41 |
$this->assertStringContainsString( '(watchlistedit-normal-explain)', $html ); |
| 42 |
} |
| 43 |
|
| 44 |
public function testClearPage_hasClearButtonForm() { |
| 45 |
$user = new TestUser( __METHOD__ ); |
| 46 |
[ $html, ] = $this->executeSpecialPage( 'clear', null, 'qqx', $user->getUser() ); |
| 47 |
$this->assertMatchesRegularExpression( |
| 48 |
'/<form action=\'.*?Special:EditWatchlist\/clear\'/', |
| 49 |
$html |
| 50 |
); |
| 51 |
} |
| 52 |
|
| 53 |
public function testEditRawPage_hasTitlesBox() { |
| 54 |
$user = new TestUser( __METHOD__ ); |
| 55 |
[ $html, ] = $this->executeSpecialPage( 'raw', null, 'qqx', $user->getUser() ); |
| 56 |
$this->assertStringContainsString( |
| 57 |
'<div id=\'mw-input-wpTitles\'', |
| 58 |
$html |
| 59 |
); |
| 60 |
} |
| 61 |
|
| 62 |
} |