Commit graph

13 commits

Author SHA1 Message Date
Tim Starling
5e30a927bc tests: Make some PHPUnit data providers static
Just methods where adding "static" to the declaration was enough, I
didn't do anything with providers that used $this.

Initially by search and replace. There were many mistakes which I
found mostly by running the PHPStorm inspection which searches for
$this usage in a static method. Later I used the PHPStorm "make static"
action which avoids the more obvious mistakes.

Bug: T332865
Change-Id: I47ed6692945607dfa5c139d42edbd934fa4f3a36
2023-03-24 02:53:57 +00:00
TChin
349819dc5a Add Message/MessageValue user group member parameter type
* Added ParamType::OBJECT, which allows Stringable objects to be passed into MessageValue

Bug: T278482
Change-Id: Ib4990f87d4ad70b7525d7aa05c8b97e90c121674
2021-11-16 11:24:35 -05:00
TChin
fb4e7a803a Add message parameter type for User Groups
Bug: T278482
Change-Id: I45da5f73f8920b79b57c02776a05d0268d3480f2
2021-10-14 15:02:13 -04:00
Daimona Eaytoy
535d7abf59 phpunit: Mass-replace setMethods with onlyMethods and adjust
Ended up using
  grep -Prl '\->setMethods\(' . | xargs sed -r -i 's/setMethods\(/onlyMethods\(/g'

special-casing setMethods( null ) -> onlyMethods( [] )

and then manual fix of failing test (from PS2 onwards).

Bug: T278010
Change-Id: I012dca7ae774bb430c1c44d50991ba0b633353f1
2021-04-16 20:15:00 +02:00
Umherirrender
a1de8b8700 Tests: Mark more more closures as static
Result of a new sniff I25a17fb22b6b669e817317a0f45051ae9c608208

Bug: T274036
Change-Id: I695873737167a75f0d94901fa40383a33984ca55
2021-02-09 02:55:57 +00:00
addshore
959bc315f2 MediaWikiTestCase to MediaWikiIntegrationTestCase
The name change happened some time ago, and I think its
about time to start using the name name!
(Done with a find and replace)

My personal motivation for doing this is that I have started
trying out vscode as an IDE for mediawiki development, and
right now it doesn't appear to handle php aliases very well
or at all.

Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
2020-06-30 17:02:22 +01:00
Petr Pchelko
7f643f2ab6 UserNameUtils: use ITextFormatter instead of MessageLocalizer
Bug: T249045
Change-Id: Ica1e1e4788d4b9f9dfcf9f8c8b4136147d92b32e
2020-04-13 09:28:02 -07:00
Brad Jorsch
3f9f2f1ca8 MediaWiki\Message: Extract Message↔MessageValue conversion from TextFormatter
The Action API is going to need to convert between the two at various
boundaries where it receives a Status from business logic.

Also when we make HtmlFormatter and the like, that'll initially need the
same conversion logic too.

Change-Id: Id5b216b033718f3ef38bfd4be1715218ee07bb93
2019-11-26 08:58:05 +00:00
Brad Jorsch
70bc2a5527 libs/Message: Fix value of ParamType::DURATION_SHORT
The values of the constants are supposed to match the keys used for the
corresponding special parameters to Message. This one was different.

Note the values of these constants are considered an internal
implementation detail, as is the format of the XML-ish output of
MessageValue::dump(), so we don't have to worry about compatibility
when changing it here.

Change-Id: If5a7279e661df8c13780552d1dee752215e1d497
2019-11-25 18:23:43 +00:00
Max Semenik
fb252d5565 TextFormatterTest: Use mocks instead of manually creating classes
Change-Id: I85cb709f277f37279f2edbe58a441b8a4043fb27
2019-10-08 21:32:25 +00:00
Brad Jorsch
c875265eff lib/Message: Support MessageValue as a parameter
Fixes an overstrict test in ListParam, and has TextFormatter convert
to Message recursively where necessary.

Change-Id: I387754b6857fbdeedea6afd222a2fdba1ebe1a9c
2019-08-30 15:14:37 -04:00
Brad Jorsch
ce79d607c7 libs/Message: Improve documentation
Among other things, this removed mention of MediaWiki classes from the
library and adds a README.md that attempts to define constraints for
interoperability between libraries producing MessageValues and formatter
implementations that are expected to handle them.

This also renames "TextParam" to "ScalarParam", as that seems a more
accurate name for the class.

Change-Id: I264dd4de394d734a87929cf4740779e7b7d0e04a
2019-08-29 17:04:01 -04:00
Tim Starling
09cd8eb080 MessageFormatterFactory
An injectable service interface for message formatting, somewhat
narrowed compared to Message.

Only the text format is implemented in this framework so far, with
getTextFormatter() returning a formatter that converts to the text
format. Other formatters could be added to MessageFormatterFactory.

Bug: T226598
Change-Id: Id053074c1dbcb692e8309fdca602f94a385bca0c
2019-08-28 12:28:05 +10:00