Commit graph

9 commits

Author SHA1 Message Date
Reedy
85396a9c99 tests: Fix @covers and @coversDefaultClass to have leading \
Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
2024-02-16 22:43:56 +00:00
Umherirrender
1b9809b310 tests: Skip failing tests on php8.2 (and make pass)
- Mark test as skipped referring known task about improve of the tests
- Mark test as skipped testing for backward-compatibility on
  parser cache serialization, test data contains old properties,
  which are now unknown and created dynamically

Change-Id: If6a4c7dbba39389b06ce64fb5cac08cd8d7dd9fc
2023-12-10 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
Tim Starling
21352255ad Protect HistoryBlob storage against malicious class injection
* Add a safe unserialize() wrapper for HistoryBlob classes
* Add a safe unserialize() wrapper for plain array data as used for
  compressed internal storage by ConcatenatedGzipHistoryBlob and
  DiffHistoryBlob.
* Fix tests broken by this.
* Fix unnecessary call to uncompress(), __wakeup() does this already.
  Was a phan error now that we have more information about the type of
  $obj.
* Add tests for successful unserialize and wakeup of WMF production
  data.

Change-Id: Ic995dda16d9c6045b33f2fdae7f6575ac8329976
2022-12-02 00:26:11 +00:00
Kevin Israel
0ae29bbb69 tests: Replace checkPHPExtension() with @requires annotations
PHPUnit 3.7.0 was the first version to support @requires extension. At
the time checkPHPExtension() was added in a7901801b4, MediaWiki
still supported PHPUnit 3.6.7.

MediaWiki now requires intl and xml, so I removed checks for those
extensions rather than converting them to annotations.

checkPHPExtension() is removed without deprecation; it does not appear
to have ever been used (and is not likely to be used) in MW extensions.
This is explicitly permitted under the stable interface policy. Even if
it were not, only tests are affected, and they are supposed to fail
anyway if hard deprecated code is used.

Change-Id: I45f9b4c0e120683103cead916f4d4ef58bd11530
2022-10-23 20:47:14 -04:00
Kevin Israel
ae0fc3b02f DiffHistoryBlob: Remove workarounds for old PECL xdiff versions
Versions of PECL xdiff older than 1.5.2 cannot be compiled against
PHP 5.4 and newer (we require PHP 7.2+). See changelog:

 https://pecl.php.net/package-changelog.php?package=xdiff

Change-Id: I28d27fd3bbac6a42827a2b46f06f25657023cc10
2022-05-31 00:11:27 -04:00
Kevin Israel
7cf5121226 DiffHistoryBlob: Don't check for hash PHP extension
MediaWiki has required this PHP extension for quite a while by now.
Furthermore, it is always available in PHP 7.4 and later.

Change-Id: Ifbf3400bca75351ea8fa461ca27259ee31543237
2022-05-31 00:11:27 -04:00
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
DannyS712
ede7dc8b68 Convert DiffHistoryBlobTest to pure unit test
No integration needed, though it did rely on
checkPHPExtension which was only available in
MediaWikiIntegrationTestCase, moved to
MediaWikiTestCaseTrait

Also put under /includes/historyblob/ to match covered class

Change-Id: I0bfe3e44bd45535c18f5ee2534430330586a1c4c
2021-04-14 02:09:51 +00:00