Commit graph

9 commits

Author SHA1 Message Date
Timo Tijhof
05c2b0dca0 Html,Xml: Widen @covers tags
> We lose useful coverage and waste valuable time on keeping tags
> accurate through refactors (or worse, forget to do so).
>
> Tracking tiny per-method details wastes time in realizing (and
> fixing) when people inevitably don't keep them in sync, and time
> lost in finding uncovered code to write tests to realize it was
> already covered but "not yet claimed".
>
> Given all used methods are de-facto and liberally claimed, and
> that we keep the coverage limited to the subject class, this
> maintains the spirit and intent. PHPUnit offers a more precise
> tool when you need it (i.e. when testing legacy monster classes),
> but for well-written code, the class-wide tag suffices.

Ref https://gerrit.wikimedia.org/r/q/owner:Krinkle+is:merged+message:Widen

Change-Id: I60151a0f5a811763fe326e92a18d3dcba8082761
2024-03-30 21:48:32 +00:00
Bartosz Dziewoński
f1d7e68cd2 Rename dropdown-related methods to avoid random camel-case
It's a dropdown, not a drop down, therefore rename:
* Html::listDropDownOptions     → Html::listDropdownOptions
* Xml::listDropDownOptions      → Xml::listDropdownOptions
* Html::listDropDownOptionsOoui → Html::listDropdownOptionsOoui
* Xml::listDropDownOptionsOoui  → Xml::listDropdownOptionsOoui
* Xml::listDropDown             → Xml::listDropdown

In PHP, method names are case-insensitive, therefore we can do this
without a breaking change or deprecation.

This also matches the naming convention in OOUI.

Change-Id: Ifda13ba9dee316709c424636ec3b285de8d0e9b1
2024-03-09 02:31:33 +01:00
Daimona Eaytoy
89f583625a tests: Add replacement for assertions deprecated in PHPUnit 9.6
expectWarning() and friends have been deprecated in PHPUnit 9.6, and
removed in PHPUnit 10. Unfortunately, there is no simple replacement
because PHPUnit no longer converts them to exceptions in the first
place. In fact, Sebastian Bergmann explicitly stated that he does not
consider the use case of

> a library developer to verify a code block warns its consumer when
> certain action is performed

worth supporting.

So, add an ad-hoc replacement for all the deprecated methods. This is
quite ugly, but it's simple enough given the low number of usages.

On the bright side, this new method does not halt the test when the
warning is triggered. This seems to align with the developers'
expectation, seen in a few existing tests, that any code following the
notice will be executed.

Bug: T342110
Change-Id: I214abfed4280834840c115777ed78eb0a5570da9
2024-02-23 22:09:45 +01:00
Reedy
85396a9c99 tests: Fix @covers and @coversDefaultClass to have leading \
Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
2024-02-16 22:43:56 +00:00
jenkins-bot
ee60406617 Merge "Remove uses of $wgUseMediaWikiUIEverywhere" 2024-02-05 13:59:51 +00:00
Bartosz Dziewoński
aa7eeeeef9 Remove uses of $wgUseMediaWikiUIEverywhere
Removing the config variable in a separate change:
Ib9966bc6a4a94f771cb99a5aa52fb6a1dc826ca5
(just in case something depends on its existence).

Bug: T182050
Change-Id: Ic3e038df16fc540ec7f6bcb9a54d73f8d596d305
2024-02-04 19:16:30 +00:00
James D. Forrester
1ed893880c Html: Copy listDropDownOptions() and listDropDownOptionsOoui() from Xml and migrate users
Bug: T356544
Change-Id: Ibcc13c92a48b3fd2a33914418dfbefb0dd890c82
2024-02-03 18:27:23 +00:00
Daimona Eaytoy
2520f3d1c4 Replace more usages of deprecated MWException
Bug: T328220
Change-Id: Ie9b56bcf5e962e275d80570cad98d676da505894
2024-01-19 22:01:12 +00:00
Umherirrender
790ae736c1 tests: Move test cases from /includes/ into sub folder
Follow move of the tested class
Most moves are part of T321882

Change-Id: I74ab45d6a5331dcb2ff0b65dc2cc7c6315146646
2023-09-13 00:09:05 +02:00
Renamed from tests/phpunit/includes/HtmlTest.php (Browse further)