diff options
author | Dreamy Jazz <wpgbrown@wikimedia.org> | 2024-08-27 13:00:25 +0100 |
---|---|---|
committer | Dreamy Jazz <wpgbrown@wikimedia.org> | 2024-08-27 13:22:29 +0100 |
commit | e7393b3cc7ade5ccc44bf5b466f26d3c51063fff (patch) | |
tree | 13350294b27d26aa87611189907be81e74ec7978 /maintenance/mysql.php | |
parent | be2bef0de5c1e59ba7f25a672349f0915b1c4d33 (diff) | |
download | mediawikicore-e7393b3cc7ade5ccc44bf5b466f26d3c51063fff.tar.gz mediawikicore-e7393b3cc7ade5ccc44bf5b466f26d3c51063fff.zip |
Exclude boilerplate maintenance code from code coverage reports
Why:
* Maintenance scripts in core have bolierplate code that is
added before and after the class to allow directly running
the maintenance script.
* Running the maintenance script directly has been deprecated
since 1.40, so this boilerplate code is only to support a now
deprecated method of running maintenance scripts.
* This code cannot also be marked as covered, due to PHPUnit
not recognising code coverage for files.
* Therefore, it is best to ignore this boilerplate code in code
coverage reports as it cannot be marked as covered and also
is for deprecated code.
What:
* Wrap the boilerplate code (requiring Maintenance.php and then
later defining the maintenance script class and running if the
maintenance script was called directly) with @codeCoverageIgnore
comments.
* Some files use a different boilerplate code, however, these
should also be marked as ignored for coverage for the same
reason that coverage is not properly reported for files.
Bug: T371167
Change-Id: I32f5c6362dfb354149a48ce9c28da9a7fc494f7c
Diffstat (limited to 'maintenance/mysql.php')
-rw-r--r-- | maintenance/mysql.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/maintenance/mysql.php b/maintenance/mysql.php index 8291ac7d83d0..0776d871c50c 100644 --- a/maintenance/mysql.php +++ b/maintenance/mysql.php @@ -27,7 +27,9 @@ use MediaWiki\Shell\Shell; use Wikimedia\IPUtils; use Wikimedia\Rdbms\ServerInfo; +// @codeCoverageIgnoreStart require_once __DIR__ . '/Maintenance.php'; +// @codeCoverageIgnoreEnd /** * @ingroup Maintenance @@ -201,5 +203,7 @@ class MysqlMaintenance extends Maintenance { } } +// @codeCoverageIgnoreStart $maintClass = MysqlMaintenance::class; require_once RUN_MAINTENANCE_IF_MAIN; +// @codeCoverageIgnoreEnd |