3 use MediaWiki\SpecialPage\SpecialPage
;
4 use MediaWiki\Specials\SpecialEditWatchlist
;
11 * @covers \MediaWiki\Specials\SpecialEditWatchlist
13 class SpecialEditWatchlistTest
extends SpecialPageTestBase
{
16 * Returns a new instance of the special page under test.
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()
33 public function testNotLoggedIn_throwsException() {
34 $this->expectException( UserNotLoggedIn
::class );
35 $this->executeSpecialPage();
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 );
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\'/',
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\'',