From d417de70fcf39e0a7a15ba780b597914d16ca0f7 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 12 Mar 2014 18:12:23 +0100 Subject: Update to MediaWiki 1.22.4 --- .../tests/ApiQueryTitleBlacklistTest.php | 132 --------------------- extensions/TitleBlacklist/tests/testSource | 5 - 2 files changed, 137 deletions(-) delete mode 100644 extensions/TitleBlacklist/tests/ApiQueryTitleBlacklistTest.php delete mode 100644 extensions/TitleBlacklist/tests/testSource (limited to 'extensions/TitleBlacklist/tests') diff --git a/extensions/TitleBlacklist/tests/ApiQueryTitleBlacklistTest.php b/extensions/TitleBlacklist/tests/ApiQueryTitleBlacklistTest.php deleted file mode 100644 index 344e9996..00000000 --- a/extensions/TitleBlacklist/tests/ApiQueryTitleBlacklistTest.php +++ /dev/null @@ -1,132 +0,0 @@ - - */ - -ini_set( 'include_path', ini_get( 'include_path' ) . ':' . __DIR__ . '/../../../tests/phpunit/includes/api' ); - -/** - * @group medium - **/ -class ApiQueryTitleBlacklistTest extends ApiTestCase { - - function setUp() { - global $wgTitleBlacklistSources; - parent::setUp(); - $this->doLogin(); - - $wgTitleBlacklistSources = array( - array( - 'type' => TBLSRC_FILE, - 'src' => __DIR__ . '/testSource', - ), - ); - } - - /** - * Verify we allow a title which is not blacklisted - */ - function testCheckingUnlistedTitle() { - $unlisted = $this->doApiRequest( array( - 'action' => 'titleblacklist', - // evil_acc is blacklisted as - 'tbtitle' => 'evil_acc', - 'tbaction' => 'create', - 'tbnooverride' => true, - ) ); - - $this->assertEquals( - 'ok', - $unlisted[0]['titleblacklist']['result'], - 'Not blacklisted title returns ok' - ); - } - - /** - * Verify tboverride works - */ - function testTboverride() { - global $wgGroupPermissions; - - // Allow all users to override the titleblacklist - $wgGroupPermissions['*']['tboverride'] = true; - - $unlisted = $this->doApiRequest( array( - 'action' => 'titleblacklist', - 'tbtitle' => 'bar', - 'tbaction' => 'create', - ) ); - - $this->assertEquals( - 'ok', - $unlisted[0]['titleblacklist']['result'], - 'Blacklisted title returns ok if the user is allowd to tboverride' - ); - } - - /** - * Verify a blacklisted title gives out an error. - */ - function testCheckingBlackListedTitle() { - $listed = $this->doApiRequest( array( - 'action' => 'titleblacklist', - 'tbtitle' => 'bar', - 'tbaction' => 'create', - 'tbnooverride' => true, - ) ); - - $this->assertEquals( - 'blacklisted', - $listed[0]['titleblacklist']['result'], - 'Listed title returns error' - ); - $this->assertEquals( - "The title \"bar\" has been banned from creation.\nIt matches the following blacklist entry: [Bb]ar #example blacklist entry", - $listed[0]['titleblacklist']['reason'], - 'Listed title error text is as expected' - ); - - $this->assertEquals( - "titleblacklist-forbidden-edit", - $listed[0]['titleblacklist']['message'], - 'Correct blacklist message name is returned' - ); - - $this->assertEquals( - "[Bb]ar #example blacklist entry", - $listed[0]['titleblacklist']['line'], - 'Correct blacklist line is returned' - ); - } - - /** - * Tests integration with the AntiSpoof extension - */ - function testAntiSpoofIntegration() { - if ( !class_exists( 'AntiSpoof') ) { - $this->markTestSkipped( "This test requires the AntiSpoof extension" ); - } - - $listed = $this->doApiRequest( array( - 'action' => 'titleblacklist', - 'tbtitle' => 'AVVVV', - 'tbaction' => 'create', - 'tbnooverride' => true, - ) ); - - $this->assertEquals( - 'blacklisted', - $listed[0]['titleblacklist']['result'], - 'Spoofed title is blacklisted' - ); - - } -} diff --git a/extensions/TitleBlacklist/tests/testSource b/extensions/TitleBlacklist/tests/testSource deleted file mode 100644 index 235cc671..00000000 --- a/extensions/TitleBlacklist/tests/testSource +++ /dev/null @@ -1,5 +0,0 @@ -[Bb]ar #example blacklist entry -.*[Ff]ail.* -.*[Nn]yancat.* -.*evil_acc.* -AW{1,10} -- cgit v1.2.2