Commit graph

15 commits

Author SHA1 Message Date
daniel 0cd6c90d5a Extract RESTbase client code into VRSParsoidClient.
This makes the "direct" client and the VRS based client
implement the same interface, so the caller doesn't have to know
which one it is using.

It looks like ParsoidHelper will not be needed if we use this approach.

Change-Id: Ib1c1d7355951fc0765227dd01a9edfc554fc448d
2022-09-14 18:20:36 +01:00
Derick Alangi b029fd8ede Introduce VisualEditorParsoidClientFactory
This patch introduces a factory service for creating VE Parsoid
clients.

NOTE: This patch also injects a GlobalIdGenerator to the client
 and avoids usage of deprecated UIDGenerator class.

Change-Id: I787c0afb227308aab56770d14d62e08eb0084a6c
2022-09-06 12:47:43 +01:00
Kosta Harlan 21de9f4728 ApiVisualEditorTest: Set Database annotation and $tablesUsed
Bug: T312849
Change-Id: Iacb1e7f3b66f93d54c2512718ea00f46a0b55c89
2022-07-12 13:07:31 +00:00
Bartosz Dziewoński 37bb0075db Add tests for the expected properties in API result and auto-save
The goal is to have some tests fail if a new property is added to the
API result, but it's not stored in auto-save data.

Bug: T305225
Change-Id: I9ac328c71c616a8f33e1cfb39431cd9a665adafc
2022-04-08 01:02:53 +02:00
Kosta Harlan 9241add01e Allow hook implementations to modify params
This is needed because the $params array is then passed on to
ApiEditPage, so if the hook implementer wants to alter the data used
with the edit, it needs to be able to modify the $params.

See I494d72a42d9103c28c4d44077cfe0f1269fc7b00 for an example where
GrowthExperiments would like to modify the 'tags' parameter for an
edit.

Depends-On: Idd052281898f99e4f13f241d5633294b59b29329
Bug: T304747
Change-Id: Ia4842a1593028f5fa145de167ccf9b72efa81351
2022-03-29 11:31:30 +00:00
Reedy 239fbb64e4 Namespace rest of the extension
Change-Id: I4f3e2793099d81401035ea282f268a3afaa03067
2022-03-14 22:27:15 +00:00
Ed Sanders 131d940d99 ApiVisualEditorTest: Assert properties in result
Change-Id: Ibc63ec4c2fc9d3b002b016d01417f61f68b9dc54
2022-03-01 15:09:58 +00:00
Thalia b0c0917f19 ApiVisualEditor: Support Special:MyLanguage for preload param
This allows nonexistent translated pages to fall back to the
corresponding page in a suitable language.

Bug: T299544
Change-Id: I43f461e9f595c364ecdaf2faccbd580fc0df6799
2022-02-25 12:23:16 +00:00
Thalia 0c5ed2e772 ApiVisualEditorTest: Avoid using VirtualRESTServiceClient
Use paction 'metadata' instead of 'parse' by default, to avoid
accidentally using VirtualRESTServiceClient when testing cases
that don't require it.

Change-Id: I02492a2dc444cf531a5c8767b0dcfe0d20ac7339
2022-02-25 12:15:37 +00:00
Thalia 8807b07d37 Add basic test for ApiVisualEditor::execute
Bug: T299791
Change-Id: I1217f065572565f076ecb24271c3b5af34e74121
2022-01-24 12:28:49 +00:00
Thiemo Kreuz a3a738b4f9 Rewrite ApiVisualEditor::getAvailableNamespaceIds()
For readability. The current implementation is a sequence of
7 (!) array_…() function calls. It is also not free from bugs.
If one of the two inputs (ExtensionRegistry and Config) specifies
namespaces by e.g. canonical name, but the other by number,
the two are not properly merged. It should be possible to use
configuration to disable a namespace that would otherwise be
enabled. This currently works only if both use the same array
keys.

Bug: T291727
Change-Id: I2671f391cdc510da21eda8a1dc5ed4d2513a378a
2021-10-01 14:10:08 +02:00
DannyS712 492fcfbd9f Don't include null in the namespaces where VE can be enabled
Bug: T291728
Change-Id: I2cb168a21c559e61bf2c9e881d46f7f23110e826
2021-09-29 16:23:48 +00:00
Thiemo Kreuz 3484f1927d Add unit tests for static ApiVisualEditor methods
Done for I2cb168a.

Change-Id: I29f8c127ea19abd3449ee0e2742c3ddcc4db23ba
2021-09-28 10:49:47 +02:00
Thiemo Kreuz 61fac2fb44 Add a first PHPUnit test for SpecialCollabPad
Change-Id: I871f3d9616a40300ee306f58b4bae5a58b57b53f
2021-08-26 12:09:59 +02:00
Thiemo Kreuz d78af2c0e9 Add a first trivial PHPUnit test
This is more a proof of concept. The PHP code in this codebase
is rather small, but not trivial, and worth being covered by
tests.

Change-Id: I20c713c3c3be5d289947a343cd4fbf5256234a4a
2021-08-20 15:20:35 +00:00