Commit graph

19 commits

Author SHA1 Message Date
Bartosz Dziewoński
6a20dc29ae editpage: Split off producing edit intro messages and preloaded content
Introduce two new classes, containing code split off from EditPage:
* IntroMessageBuilder (edit notices and other intro messages)
* PreloadedContentBuilder (initial text of new pages / sections)

I'm doing both of these features in one change, because they share a
lot of code. They are meant to be used by alternative editors to
support all of the features of the MediaWiki edit form. This isn't
everything you need yet (we should at least do this for the edit
checkboxes too), but it's a step.

Bug: T201613
Change-Id: If0b05710cb52a977bf4e85947d72d68683a0a29e
2023-05-16 20:51:00 +02: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
Derick Alangi
88c571170e tests: Migrate setMwGlobals() to overrideConfigValue(s)
Change-Id: I13a82dc57a86f74c713a11eff26488bee06903e2
2022-07-27 18:07:00 +01:00
Timo Tijhof
5905854ab1 Permissions: Add strict return types and minor doc cleanup
Fix broken tests because:
> TypeError: Return value of
> PermissionManager::getNamespaceRestrictionLevels() must be of the
> type array, boolean returned

Change-Id: I1546ffda7fafe23bccfa6d8792fc8cf95bbbb43b
2022-05-21 23:05:32 +01:00
Derick Alangi
b648efacc5 editpage: Replace usage of Title in TextboxBuilder::class
In order for us to keep backward compatibility, cast the page identity
back to a Title in: `buildTextboxAttribs()` and use within the code.

Change-Id: Ia55251ee7f730636d6e85bf069734ff462119f0d
2021-09-20 10:24:00 +01:00
Petr Pchelko
6a8a786599 Replace easy usages of User for UserIdentity/Authority
Change-Id: Id176ee0fab64707020ac6c47a087ef00f8bed4e3
2021-06-09 07:53:52 -07:00
Kunal Mehta
ec0be22116 Update Legoktm's email address
Change-Id: Icd58c93bb0cff5b0a4e7b7f02873a271bab8964f
2021-05-02 05:39:37 +00:00
DannyS712
dfa5a5af76 TextboxBuilderTest: merge single use method
No need for separate mockProtectedTitle()
Also use $this->createMock()

Change-Id: I3ef88aea386ca59a682d8959e134686c295c58cb
2021-03-11 16:32:24 +00:00
DannyS712
008e09f766 Split TextboxBuilderTest into separate unit tests
Change-Id: I7faa32e6ab6c318cef9ede274096aecd2ec76cac
2021-03-01 18:26:46 +00:00
Umherirrender
7691dbeca9 Add missing @param and @return to documentation in tests
Change-Id: Ic663e81cca0bf007804a70772250914a85f1fef4
2021-01-22 19:57:25 +01:00
Ammar Abdulhamid
61b5970a30 Hard deprecate NamespaceInfo::getRestrictionLevels
It's overdue and appears unused

Change-Id: I5d7f4a52b3258b2e711792ac0f5487f0b44c92a6
2020-11-16 04:40:24 +01: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
Daimona Eaytoy
6365eaab8d Autofix 94 PHPUnit 8 compat issues
Done automatically using the master version of MW codesniffer and
running composer fix.

Bug: T192167
Change-Id: If6b40f515fde32ab5eff074a90e821c30c791827
2019-12-13 15:29:10 +01:00
Aryeh Gregor
0de9c47b50 Remove Language::factory and getParentLanguage use
Change-Id: I11f8801ef47ec1a1f63d840116e69667e6f3ae3c
2019-10-27 12:34:28 +02:00
Aryeh Gregor
2e1ac38485 Mass conversion to NamespaceInfo
Change-Id: I2fef157ceec772f304c0923a1cd8c0eef2e82a0f
2019-05-07 22:44:56 +02:00
WMDE-Fisch
85c7ac60c8 Use Sanitizer::mergeAttributes when merging classes into attributes
Change-Id: Ia5199a75e6926fe64b3d99d5b5914320491176bb
2018-01-05 10:32:56 +01:00
WMDE-Fisch
fb9a36c049 Moved textbox1 building into TextConflictHelper on edit conflicts
Factored out some minor parts about building editor CSS classes.

getEditConflictMainTextBox() mainly mirrors showTextbox1 parts not
included were moved to the EditPage.

Change-Id: I671e095acc08382dd0a1c3d167fdaaa623ec5499
2018-01-04 18:21:13 +00:00
Kunal Mehta
14e7d5401c Add tests for TextboxBuilder
Change-Id: I305e0bce902fb027bf02cc8a28e8846808f6437c
2017-12-27 17:49:21 +00:00