Commit graph

11 commits

Author SHA1 Message Date
James D. Forrester
4cf719019a Namespace remaining files in includes/site
Bug: T353458
Change-Id: I38da09f28cd68add721ba7b05f351acb56515d95
2023-12-14 14:57:34 -05:00
Amir Sarabadani
74287cf721 Namespace Site and SiteList
Bug: T353458
Change-Id: I31f7cba42c02701e462eb3ed6bcc3928d438c1ef
2023-12-14 11:23:56 -05:00
Umherirrender
388b0374fa tests: Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statements and changes to docs done manually

Change-Id: Ib326ae1e5c8409a98398c721e8b8ce42c73bd012
2023-12-11 15:59:55 +01:00
Daimona Eaytoy
59b93e9e4f Avoid DB access in non-database tests
Mock the needed dependencies to avoid database access when possible, and
add the test to the Database group otherwise.

Bug: T155147
Change-Id: Ic5c39ab35ab4d993721713285180f072497a5a40
2023-08-06 22:57:48 +00:00
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
James D. Forrester
ad06527fb4 Reorg: Namespace the Title class
This is moderately messy.

Process was principally:

* xargs rg --files-with-matches '^use Title;' | grep 'php$' | \
  xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1'
* rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \
  xargs rg --files-with-matches 'Title\b' | \
  xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1'
* composer fix

Then manual fix-ups for a few files that don't have any use statements.

Bug: T166010
Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a
Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
2023-03-02 08:46:53 -05:00
Bartosz Dziewoński
84a43f20f0 Simplify callback in HTMLForm tests
The anonymous function was equivalent to just specifying 'wfMessage'.
Same as in I355504984d343a2c7c469759f791612c5b6d6556 in Wikibase.

Change-Id: Ib94b7cceabce25ca95374d944255c7197e6a476a
Follows-Up: Ica0740049f0a3e8ec764903c5b71825e4d628a3f
2023-01-10 21:34:00 +01:00
Brian Wolff
07cdef809c Deprecate creating HTMLFormFields without reference to parent form
Currently it is documented that mParent in HTMLFormField may be null.
This can happen if the form element is constructed manually via
new, instead of the normal way via HTMLForm methods.

As it stands, much of the code assumes that mParent is always set
despite the documentation. Lets mark creating form fields without
parent set as deprecated. The current situation seems like a
recipe for bugs, and after the deprecation period this would allow
us to simplify some of the HTMLFormField code.

Bug: T326456
Change-Id: Ica0740049f0a3e8ec764903c5b71825e4d628a3f
Depends-On: I15a39605e3eec8a5c265c4a331039fa906eda036
2023-01-08 18:20:16 -08:00
Thiemo Kreuz
312566d156 Use more specific assertions in HTMLTitleTextField test
I would like to argue that it's useful to know if an error message is
returned, and if it's the correct one.

Bug: T306568
Change-Id: I865fa4c8a5b2d2d88d26c190352c852e63913a56
2022-04-23 22:10:26 +02:00
Martin Urbanec
408999928d
HTMLTitleTextField: Remove B&C code
Bug: T288181
Change-Id: Iec9225d0f0fe47dd972f6c302ca803e65b8232a7
2021-09-22 00:48:59 -07:00
Gergő Tisza
16f3b8c4c0 Make HTMLTitleTextField interwiki option tri-state
Make the 'interwiki' option temporarily accept null as well as true/false
(and default to null instead of false) so form fields which disallow
interwiki titles can avoid deprecation warnings. This also includes
implementing the new error message.

The idea is that for the duration of the deprecation process, form fields
can be set explicitly to interwiki => false (which will eventually become
the default). It would be super annoying to have to do this for all
title fields, but this way it's only needed for fields where users actually
submit interwiki titles with some frequency.

Also improve the logic for legacy fields (which do not set the option
either way): since these (while emitting a warning) allow an interwiki
title, it does not make sense to apply namespace etc. checks to that
title.

Bug: T288155
Change-Id: Ic00f4a0f27747b5ff0893b4c01f42f68a99771ab
2021-08-04 21:24:16 -07:00