]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - tests/phpunit/includes/specials/SpecialEditWatchlistTest.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / tests / phpunit / includes / specials / SpecialEditWatchlistTest.php
1 <?php
2
3 /**
4  * @author Addshore
5  *
6  * @group Database
7  *
8  * @covers SpecialEditWatchlist
9  */
10 class SpecialEditWatchlistTest extends SpecialPageTestBase {
11
12         /**
13          * Returns a new instance of the special page under test.
14          *
15          * @return SpecialPage
16          */
17         protected function newSpecialPage() {
18                 return new SpecialEditWatchlist();
19         }
20
21         public function testNotLoggedIn_throwsException() {
22                 $this->setExpectedException( 'UserNotLoggedIn' );
23                 $this->executeSpecialPage();
24         }
25
26         public function testRootPage_displaysExplanationMessage() {
27                 $user = new TestUser( __METHOD__ );
28                 list( $html, ) = $this->executeSpecialPage( '', null, 'qqx', $user->getUser() );
29                 $this->assertContains( '(watchlistedit-normal-explain)', $html );
30         }
31
32         public function testClearPage_hasClearButtonForm() {
33                 $user = new TestUser( __METHOD__ );
34                 list( $html, ) = $this->executeSpecialPage( 'clear', null, 'qqx', $user->getUser() );
35                 $this->assertRegExp(
36                         '/<form class="mw-htmlform" action=".*?Special:EditWatchlist\/clear" method="post">/',
37                         $html
38                 );
39         }
40
41         public function testEditRawPage_hasTitlesBox() {
42                 $user = new TestUser( __METHOD__ );
43                 list( $html, ) = $this->executeSpecialPage( 'raw', null, 'qqx', $user->getUser() );
44                 $this->assertContains(
45                         '<textarea id="mw-input-wpTitles"',
46                         $html
47                 );
48         }
49
50 }