Commit graph

11 commits

Author SHA1 Message Date
Matěj Suchánek
45390a52eb Clean up tests
Replace strpos with str_contains, str_starts_with, etc.
Fix spelling of "cannot" and other typos.

Change-Id: Ie52900b323f46d1978a9dd9ea3b17619b8942160
2024-02-12 09:25:25 +01:00
Amir Sarabadani
1ea0cd41bf Switch to run.php in documentation
Currently, running --help on maint scripts recommends running them
directly. With this change, it'll recommend using run.php instead.

Change-Id: Idec3958aacee8d8ef14ef1033f6c5d7c281bb750
2023-04-13 21:43:09 +00:00
jenkins-bot
63ed5bc95b Merge "tests: Fix @covers for MaintenanceParametersTest" 2023-03-27 06:36:12 +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
Umherirrender
98af2ed7df tests: Fix @covers for MaintenanceParametersTest
Follow-Up: Ib67667fead8350e0a539323fb05b160f4c2d882e
Change-Id: Ib3f0dfb578a31c31d38023b5590cf2119a1fe57e
2023-03-23 23:52:41 +01:00
daniel
52ebdb1ed0
Maintenance: Add support for documenting multi-args
Add suppor for documenting multi-value positional args.

Also fixes an issue with errors about missing args being shown even when
--help is given.

Change-Id: I6e07115aaa0f557614979adcd3f0423dd37fe8bc
2023-01-28 22:34:52 -08:00
daniel
963ef5d645 Maintenance: improve option help
Refer to "options" consistently, instead of sometimes using the term
"parameters".

Only list required options synopsis, and include option value placeholders.

The synopsis will now look simething lieke this:
USAGE: php foo [OPTION]... --param <PARAM> --something <SOMETHING> <X> [y]

Change-Id: Idb2f309ee442f0e5f597e0fc15537f90944f28b0
2023-01-23 19:30:56 +00:00
daniel
180f0a6468 Introduce run.php for running maintenance scripts
Maintenance scripts can now be run like this:

    maintenance/run.php <class>

NOTE: This introduces a new callback into Setup.php,
MW_FINAL_SETUP_CALLBACK. In contrast to MW_SETUP_CALLBACK, it is
called after extensions have been initialized.

Bug: T99268
Change-Id: Ia221f72d6b7d23df74623d60ade7fe3e5d913074
2022-12-21 06:52:04 +00:00
Umherirrender
c6fecd5ab0 tests: Replace assertEmpty with assertSame
assertSame avoids use of loose comparisons and
allows to check the expected type

Change-Id: If821d1be2bc1ff9f8b70968a339f33c7a8e8880a
2022-11-25 00:42:53 +01:00
daniel
18d3ad081d Runner: Handle more params in runner.
This moves the handling for the following parameters fully into the
MaintenanceRunner class:
  --conf, --wiki, --globlas, --memory-limit, --server, --profiler

Change-Id: I63624ba1fcbcf446630eba1b81b2c84b1a943932
2022-06-13 16:10:51 +00:00
daniel
a9f47fd5ad Extract parameter handling from Maintenance base class.
We will need parameter handling in the runner as well as in the actual
maintenance script. So pull it out, so we can re-use it.

Change-Id: Ib67667fead8350e0a539323fb05b160f4c2d882e
2022-05-25 10:40:24 +02:00