Commit graph

18 commits

Author SHA1 Message Date
Umherirrender
45da581551 Use ::class to resolve class names in tests
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: Ie541a7baae10ab6f5c13f95ac2ff6598b8f8950c
2018-01-26 22:49:13 +01:00
Brad Jorsch
fa2724fa84 LogFormatter: Don't return a non-array from formatParameterValueForApi
If the title for a 'title' or 'title-link' type is invalid, the code
still must not return a non-array from the method.

I'm not sure this is what was behind T176938, but it's the only thing I
can find that might cause the errors I saw logged at about the same
time.

Change-Id: Iae77eb6ad9a64d8b67074164ff0c0fea36826f3c
2017-09-28 10:06:53 -04:00
Timo Tijhof
8596a01658 phpunit: Make LogFormatterTest less slow
Right now it's quite slow because it reloads LocalisationCache
for every test case.

Change the reload to only happen once for the entire class.

Also use RequestContext instead of wgLang to match logic in
the parent class (MediaWikiLangTestCase).

$ phpunit includes/logging/LogFormatterTest.php
Before
- run 1) Time: 23.56 seconds, Memory: 48.00MB
- run 2) Time: 22.41 seconds, Memory: 48.75MB
After
- run 1) Time: 14.27 seconds, Memory: 47.50MB
- run 2) Time: 13.45 seconds, Memory: 47.25MB

Change-Id: Ia791563ca9094c36782acfe9826def45f2a1d621
2017-04-14 23:44:23 +00:00
James D. Forrester
1e9c361960 tests: Replace implicit Bugzilla bug numbers with Phab ones
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.

Change-Id: I46261416f7603558dceb76ebe695a5cac274e417
2017-02-21 02:14:34 +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
Amir E. Aharoni
bfdd3369c2 Fix Generic.Files.LineLength phpcs check in files under phpunit/includes
Bug: T102614
Change-Id: Iee3df5f064f595ecebe8210cc936bc3d20a122c9
2015-10-03 17:13:29 +00:00
addshore
349ca056b7 Move LogFormatter test comment block
This was missed in:
https://gerrit.wikimedia.org/r/#/c/239783/
Ia5016c82c00dd7c35a6f1253d6e385b587ec485e

Change-Id: Ibf537aaca2a0ca9d2c509499f6da5b9e51b06037
2015-09-25 15:36:06 +00:00
umherirrender
d6961552b3 Migrate protect log to new log system
This localize the protect type, level and expiry on Special:Log/protect.
To allow i18n there are some details stored in the log params of new log
items, these details also shown on API output.
The details cannot get from the old existing data, because there are
containing L10n strings therefore i18n works only for new items.
In the api and for IRC the old description text is still stored in the
log params for backward compatibility.

This allows use of gender on Special:Log. Old messages are kept for use
in IRC. Tests already exists to ensure an unchanged IRC message.

Bug: T47988
Change-Id: I3bb85c61b857972e66c99c499d7d785c88cafb25
2015-09-25 17:07:50 +02:00
addshore
829d1a4c15 Cleanup RecentChangeTest, move things out that don't belong
This moves out a bunch of stuff that doesnt
seem to test anything in RecentChange....

This also shows us how few tests RecentChange
actually has!

Change-Id: Ia5016c82c00dd7c35a6f1253d6e385b587ec485e
2015-09-21 14:33:10 +01:00
Brad Jorsch
61233fc847 API: Move parameter formatting into LogFormatter
This allows for extensions to format their log entry parameters, and
keeps the code for formatting API log entry parameters in the same place
as for other formatting.

This also takes the opportunity to rearrange the output format slightly
to avoid conflicts like what's happening in T73020.

Bug: T35235
Bug: T73020
Bug: T91466
Change-Id: I6846ce09322eb404c506b5a51780a44ce9279fe2
2015-04-17 04:59:41 +00:00
umherirrender
ea18e5efe7 Call Language::getLocalisationCache() static
Change-Id: Ibbe03b92f2beebaaf93ba9e3c5bebbf3d7626b7a
2014-01-04 21:33:12 +01:00
Alexandre Emsenhuber
2d0e98df31 Change mode of non-executable files back to 0644
Change-Id: Ib9dce1eea8c34986364aabed7f1770101c72c649
2013-11-05 08:13:32 +01:00
addshore
749599fc3c @covers tags for unit tests
Change-Id: I2b486b38326bf23bd379efba2142034e24c0745f
2013-10-24 18:22:57 +01:00
Siebrand Mazeland
de04f37ef1 Update formatting
5 of n.

Change-Id: I811ca957b6588085d67606ebc0cd4033a1e53839
2013-02-15 12:35:50 +00:00
Brad Jorsch
3b1ce49023 (bug 43307) L10n recache needed in LogFormatterTest::tearDown
LogFormatterTest replaces all extension localization files in
$wgExtensionMessagesFiles with its own, and correctly restores this
variable. But it neglects to refresh the localization cache after
restoring the variable, so subsequent extension tests are missing their
localization.

Change-Id: I74809af47830a5e09c36f8fec20c9c65b1e3aa17
2012-12-20 14:55:40 -05:00
jan
8b5bfd8b88 (bug 24620) Add types and test for LogFormatter
This change adds types to LogFormatter like "msg" so log values
(parameters for the log message) can be formated as e.g. a message in
user or content language.

This change adds tests for LogFormatter, too. Tested are the normal log
params, the log params with type and the output of the comment.

This change repairs the changes I6a56c204 and I7218a173

Change-Id: Ief3665056b3bb613ff709821306017ee7967c444
2012-12-12 01:00:03 +00:00
Siebrand
1879a95a76 Revert "(bug 24620) Add tests for LogFormatter"
As I6a56c204 breaks extensions because of changing protected methods to public, this has to be reverted. We need a solid solution and the next 1.21-wmf is being branched tomorrow. Revert is the sanest solution at the moment.

This reverts commit 888fe0ffb3
2012-12-10 01:23:07 +00:00
jan
888fe0ffb3 (bug 24620) Add tests for LogFormatter
This change adds tests for LogFormatter. Tested are the normal log
params, the log params with type and the output of the comment.

Change-Id: I7218a1738c97db1d888605cecdfbffe21ca00fbf
2012-12-10 00:01:14 +00:00