diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
commit | 1de335ad3f395ca6861085393ba366a9e3fb4a0d (patch) | |
tree | f1fdd326034e05177596851be6a7127615d81498 /tests/phpunit/includes/SpecialPageTest.php | |
parent | 9c75fa8ff6d4d38ef552c00fef5969fb154765e8 (diff) | |
parent | f6d65e533c62f6deb21342d4901ece24497b433e (diff) |
Merge commit 'f6d65'
# Conflicts:
# skins/ArchLinux/ArchLinux.php
Diffstat (limited to 'tests/phpunit/includes/SpecialPageTest.php')
-rw-r--r-- | tests/phpunit/includes/SpecialPageTest.php | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/tests/phpunit/includes/SpecialPageTest.php b/tests/phpunit/includes/SpecialPageTest.php deleted file mode 100644 index 245cdffd..00000000 --- a/tests/phpunit/includes/SpecialPageTest.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php - -/** - * @covers SpecialPage - * - * @group Database - * - * @licence GNU GPL v2+ - * @author Katie Filbert < aude.wiki@gmail.com > - */ -class SpecialPageTest extends MediaWikiTestCase { - - protected function setUp() { - parent::setUp(); - - $this->setMwGlobals( array( - 'wgScript' => '/index.php', - 'wgContLang' => Language::factory( 'en' ) - ) ); - } - - /** - * @dataProvider getTitleForProvider - */ - public function testGetTitleFor( $expectedName, $name ) { - $title = SpecialPage::getTitleFor( $name ); - $expected = Title::makeTitle( NS_SPECIAL, $expectedName ); - $this->assertEquals( $expected, $title ); - } - - public function getTitleForProvider() { - return array( - array( 'UserLogin', 'Userlogin' ) - ); - } - - /** - * @expectedException PHPUnit_Framework_Error_Notice - */ - public function testInvalidGetTitleFor() { - $title = SpecialPage::getTitleFor( 'cat' ); - $expected = Title::makeTitle( NS_SPECIAL, 'Cat' ); - $this->assertEquals( $expected, $title ); - } - - /** - * @expectedException PHPUnit_Framework_Error_Notice - * @dataProvider getTitleForWithWarningProvider - */ - public function testGetTitleForWithWarning( $expected, $name ) { - $title = SpecialPage::getTitleFor( $name ); - $this->assertEquals( $expected, $title ); - } - - public function getTitleForWithWarningProvider() { - return array( - array( Title::makeTitle( NS_SPECIAL, 'UserLogin' ), 'UserLogin' ) - ); - } - - /** - * @dataProvider requireLoginAnonProvider - */ - public function testRequireLoginAnon( $expected, $reason, $title ) { - $specialPage = new SpecialPage( 'Watchlist', 'viewmywatchlist' ); - - $user = User::newFromId( 0 ); - $specialPage->getContext()->setUser( $user ); - $specialPage->getContext()->setLanguage( Language::factory( 'en' ) ); - - $this->setExpectedException( 'UserNotLoggedIn', $expected ); - - // $specialPage->requireLogin( [ $reason [, $title ] ] ) - call_user_func_array( - array( $specialPage, 'requireLogin' ), - array_filter( array( $reason, $title ) ) - ); - } - - public function requireLoginAnonProvider() { - $lang = 'en'; - - $expected1 = wfMessage( 'exception-nologin-text' )->inLanguage( $lang )->text(); - $expected2 = wfMessage( 'about' )->inLanguage( $lang )->text(); - - return array( - array( $expected1, null, null ), - array( $expected2, 'about', null ), - array( $expected2, 'about', 'about' ), - ); - } - - public function testRequireLoginNotAnon() { - $specialPage = new SpecialPage( 'Watchlist', 'viewmywatchlist' ); - - $user = User::newFromName( "UTSysop" ); - $specialPage->getContext()->setUser( $user ); - - $specialPage->requireLogin(); - - // no exception thrown, logged in use can access special page - $this->assertTrue( true ); - } - -} |