Commit graph

26 commits

Author SHA1 Message Date
Aryeh Gregor
355e21590a Use setContentLang() instead of setMwGlobals()
This changes behavior in some tests by making them set $wgLanguageCode
as well as $wgContLang, but that seems like a good thing.

Bug: T200246
Change-Id: I936888f46ff9fefe2707efba837e2ce3a7ca5e3f
2018-07-26 11:35:58 +00:00
Max Semenik
aa9bbe6051 tests: Remove some unused stuff in phpunit tests
Change-Id: Ica20e4f4ac0887b7cac12700ffcd15f587b3ba01
2018-03-26 22:45:29 +00:00
Adam Roses Wight
c7e8c25e8f New namespace MediaWiki\Tests\Maintenance
Bug: T184775
Change-Id: I041b8eb4f1ef3cf882a8082ff3f208604b8edf96
2018-01-16 15:09:44 -05:00
MusikAnimal
d09554b6ef Add basic IP range support to Special:Contributions
This works by using the new table introduced with T156318.

The only thing that differs from normal Special:Contribs is we are
showing the IP address next to each entry. This is it how it is
displayed if you request to see newbie contributions:
https://en.wikipedia.org/wiki/Special:Contributions?contribs=newbie

For the time being, Special:DeletedContributions does not support
IP ranges. Various other irrelevant links such as Uploads and Logs
are also hidden.

Refer to P4725 for a way to automate creation of edits by random
IPs in your dev environment.

IP::isValidBlock() has been deprecated with this dependent change:
https://gerrit.wikimedia.org/r/#/c/373165/

Bug: T163562
Change-Id: Ice1bdae3d16cf365da14c6df0e8d91d2b914e064
2017-09-05 16:15:33 -04:00
Reedy
b5656b6953 Many more function case mismatches
Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
2016-03-19 00:20:58 +00:00
Reedy
1834ee3d8e Fix numerous class/function casing
Change-Id: I23982bfa0548c9ea3bdb432be7982f1563930715
2016-03-18 23:14:49 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
This, that and the other
4abb459392 Refactor dumpBackup.php and dumpTextPass.php to be Maintenance subclasses
Use the Maintenance class's new $orderedOptions and support for
passing options multiple times. This allows for option "chaining".

The BackupDumper and TextPassDumper class now extend Maintenance, but
should continue to function as before. The public function processArgs()
has been removed and replaced by processOptions(), which takes no
parameters. It is unlikely that users of these classes were calling
processArgs.

Inheritors of these classes that overrode processOption() will now need to
override processOptions() and use Maintenance::getOption() and friends.

The maintenance/backupTextPass.inc file has been deleted. Users should
include maintenance/dumpTextPass.php instead.

Bug: T122587
Change-Id: I2473ee119c185d1b2b00ac4b1e70ee8a6cafe4a3
2015-12-31 20:46:54 +11:00
umherirrender
41c0c205ae Move comment in backup_PageTest.php
Move the comment at the begin of the function out of it to a doc
comment.

Change-Id: I6febf51a74de88204d54b1e3251df187197c1819
2015-10-14 09:08:52 +00:00
Siebrand Mazeland
4ede8c2e9d Pass phpcs-strict on some test files (11/11)
Woo!

Change-Id: I9fc116dfdf18c2772d047adb5bb14535d0bd39ed
2014-04-24 13:51:05 -07:00
umherirrender
5dbfd5bf80 Fixed spacing
- Removed trailing spaces in comments
- Removed multiple empty lines
- Removed space after object operator

Change-Id: I9fd3256ab490c7cd2034de3fd94e6be6e6d6d8f2
2013-11-21 18:52:25 +00:00
addshore
86adcfb8b7 @covers tags for maintenance tests
Change-Id: Ica5f351f71ee5fccae97560f2de6d75fc5da721b
2013-10-24 19:12:22 +01:00
Timo Tijhof
4bd5471ca3 docs: Remove odd colons after @todo
Most were this way already:
https://doc.wikimedia.org/mediawiki-core/master/php/html/todo.html

Ran a find/replace on the odd ones. Also made them all
lower case.

Change-Id: I70c6a69344ddebc603e9a1c1d87e3cc4f4f4c560
2013-05-15 06:23:40 +00:00
Siebrand Mazeland
791d0b2a98 Update code formatting
Change-Id: I16a9b42651f1cfb1a70dffbb67b7b83dfeb90d03
2013-04-26 14:21:20 +00:00
Siebrand Mazeland
69d4d69096 Update formatting
11 of n.

Change-Id: Ifdaf198b16bf72e1e0a3d3802c041d239096ae28
2013-02-15 13:41:06 +00:00
btongminh
a0b99c4372 Dump unit tests no longer fail if gzip is not available
Change-Id: Id1890984124028cb44960977c18572f1f6fded4c
2013-01-29 10:31:01 +00:00
Antoine Musso
0fd05285d7 pass codesniffer on tests/
Fix almost all occurences of the following sniffs:

Generic.CodeAnalysis.UselessOverridingMethod.Found
Generic.Formatting.NoSpaceAfterCast.SpaceFound
Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma
Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine
Generic.PHP.LowerCaseConstant.Found
PSR2.Classes.PropertyDeclaration.ScopeMissing
PSR2.Files.EndFileNewline.TooMany
PSR2.Methods.MethodDeclaration.StaticBeforeVisibility

Change-Id: I96aacef5bafe5a2bca659744fba1380999cfc37d
2013-01-28 12:14:26 +01:00
umherirrender
b8b9c6d6cd Wrong namespace in BackupDumperPageTest::testFullTextPlain
The problem here is, that title objects are created before wgContLang is
changed, so the title can contains wrong namespace names.

1) BackupDumperPageTest::testFullTextPlain
Text of node title
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Diskussion:BackupDumperTestP1'
+'Talk:BackupDumperTestP1'

Change-Id: I975c0f6ae7e6f51b038fe41edda2f54cd8c97eb6
2012-12-31 13:35:45 +00:00
umherirrender
9e9fb36ca2 Set wgLanguageCode/wgContLang for backup_PageTest.php
There is namespace handling, which fails on $wgLanguageCode = 'de';

Change-Id: I99a4a1837e5db5eb22cb879898da3ac37439264d
2012-11-10 19:50:13 +01:00
daniel
759518bdde Fixing dump tests for non-wikitext in NS_MAIN.
Change-Id: I7945a1b950d3b9b394a336813abc8cd1e288766f
2012-10-12 17:34:29 +02:00
Timo Tijhof
181c7cdc8e Clean and repair many phpunit tests (+ fix implied configuration)
This commit depends on the introduction of
MediaWikiTestCase::setMwGlobals in change Iccf6ea81f4.

Various tests already set their globals, but forgot to restore
them afterwards, or forgot to call the parent setUp, tearDown...

Either way they won't have to anymore with setMwGlobals.

Consistent use of function characteristics:
* protected function setUp
* protected function tearDown
* public static function (provide..)

(Matching the function signature with PHPUnit/Framework/TestCase.php)

Replaces:
 * public function (setUp|tearDown)\(
 * protected function $1(

 * \tfunction (setUp|tearDown)\(
 * \tprotected function $1(

 * \tfunction (data|provide)\(
 * \tpublic static function $1\(

Also renamed a few "data#", "provider#" and "provides#" functions
to "provide#" for consistency. This also removes confusion where
the /media tests had a few private methods called dataFile(),
which were sometimes expected to be data providers.

Fixes:

TimestampTest often failed due to a previous test setting a
different language (it tests "1 hour ago" so need to make sure
it is set to English).

MWNamespaceTest became a lot cleaner now that it executes with
a known context. Though the now-redundant code that was removed
didn't work anyway because wgContentNamespaces isn't keyed by
namespace id, it had them was values...

FileBackendTest:
* Fixed: "PHP Fatal: Using $this when not in object context"

HttpTest
* Added comment about:
  "PHP Fatal: Call to protected MWHttpRequest::__construct()"
  (too much unrelated code to fix in this commit)

ExternalStoreTest
* Add an assertTrue as well, without it the test is useless
  because regardless of whether wgExternalStores is true or false
  it only uses it if it is an array.

Change-Id: I9d2b148e57bada64afeb7d5a99bec0e58f8e1561
2012-10-09 03:01:51 +02:00
umherirrender
afa123ccf8 (bug 33222) Add parentid to revision in export xml
From bug description: "This is helpful for incremental dumps, to know if
there are revisions missing between the last full dump and this
incremental dump"

Change-Id: I772f976942a306ad573efc659d09714e8250f5ec
2012-06-09 15:41:55 +02:00
awjrichards
c29fd59775 Big oops - merged to wrong branch.
Revert "Revert to arbitrarily old point before initial remote branch creation to help clean up"

This reverts commit ee0d3d330f
2012-06-05 22:58:54 +00:00
awjrichards
ee0d3d330f Revert to arbitrarily old point before initial remote branch creation to help clean up
Change-Id: I41a3d1e55d3ea9dffa42451237fe065f9334361d
2012-06-02 08:43:04 -07:00
Platonides
92d6102e51 Inherit DumpTestCase from MediaWikiLangTestCase, since
backup_PageTest expect the ContentLanguage to be English
(backupTextPassTest and backup_LogTest also get the change,
but don't require it)

Change-Id: I8b3482df011bccd9fe520ba07c8b8d70de3b9dbb
2012-06-03 16:55:38 +02:00
Christian Aistleitner
76cefaf165 Adding tests for dumps
Change-Id: I9aa3b6d7349458b3e2b2c7111bda739bacc22f9f
2012-04-28 11:37:07 +02:00