Commit graph

22 commits

Author SHA1 Message Date
Thiemo Kreuz
b655f382db Remove broken/outdated @param/@throws tags from @dataProviders
My personal best practice is to not document @params when there
is a @dataProvider. I mean, these test…() functions are not
meant to be called from anywhere. They do not really need
documentation. @param tags don't do much but duplicate what the
@dataProvider does. This is error-prone, as demonstrated by the
examples in this patch.

This patch also removes @throws tags from tests. A test…() can
never throw an exception. Otherwise the test would fail.

Most of these are found by the not yet released I10559d8.

Change-Id: I3782bca43f875687cd2be972144a7ab6b298454e
2021-01-21 03:42:42 +00:00
Umherirrender
0347fd0631 Improve some function documentation in tests
Also fix some whitespaces

Change-Id: Ibed50a4f07442d3f299cf545c16f5dbb5f27a411
2021-01-14 22:13:55 +01:00
daniel
353d985620 Revision: Point to findBadBlobs.php in exception messages
Advertize the fact that production errors resulting from corruption in
the content storage layer can be remedied using findBadBlobs.php.

Change-Id: I4eab773d0d2da57a545f211c2fef36146331c570
2020-08-23 00:50:32 +00: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
daniel
495323c063 Remove compat code for pre-MCR schema.
NOTE: This was manually tested to ensure it does not
break updates, see T242764.

Bug: T198557
Change-Id: I1d9f5465018bae10124514bc38169e23e0e613e6
2020-03-24 19:45:47 +01:00
Thiemo Kreuz
6b2c9deef5 Replace all new stdClass() with identical (object)[]
This should be the exact same. Its more a style change than anything.
So why do it then?
* I believe this is much less confusing than code mentioning a weird
"standard class". Barely anybody knows what this is, and what the
difference between "object" and "stdClass" is.
* The code is shorter.
* It's even faster. In my micro benchmark it's twice as fast.

Change-Id: I7ee0e8ae6d9264a89b6cd1dd861f0466ae620ccc
2020-03-04 21:18:30 +00:00
daniel
292decc425 BlobStore: support "known bad" addresses.
This adds support for addresses starting with the prefix "bad:",
which will always resolve to an empty string.
The syntax for addresses supported by SqlBlobStore is relaxed
to be closer to RFC 3986 and make it easier to include meaningful
information after the "bad:" prefix.

Bug: T240686
Change-Id: I175b1880ce94ff8a9079bc50440cde188e57d95d
2020-01-03 16:38:13 +01:00
Max Semenik
e14fa40ecd More backwards compatible changes for PHPUnit
The change in XmlTest is because PHPUnit 8 messes with serialization
settings.

Bug: T192167
Change-Id: I5c9358d7cfc451845e01fca67c8d15add4039dae
2019-11-12 17:07:23 -08:00
daniel
e1f8a8148d SqlBlobStore HOT FIX: remove caching from getBlobBatch
This is a TEMPORARY HACK to fix a problem with cached values
getting mixed up when using getBlobBatch(). As of the creation of this
patch, the actual cause is unknown. Caching should be put back once the
cause of the problem has been found.

Note that getBlobBatch is only used in maintenance scripts.
Removal of caching in that method has no effect on web requests.

getBlobBatch() was introduced in I56306c50a661 and is used by
RevisionStore::getContentBlobsForBatch(), which in turn is needed
by the Translate extension to remove its dependency on the deprecated
rev_text_id field.

Bug: T235188
Change-Id: I94c6f9ba7b9caeebaa9b055916f15f7bbdcd8fb6
2019-10-16 23:02:52 +00:00
daniel
46bb49dbfd SqlBlobStore: test caching behavior.
Something is going wrong with the way we use WANObjectCache in
getBlobBatch. This patch introduces a test case that should help narrow
down the cause.

Bug: T235188
Change-Id: I2d06c09609874440992e6c90d3ebfa15400ac302
2019-10-14 14:01:06 +00:00
Daimona Eaytoy
98fcdd8f7d Replace setExpectedException with single arg
Find: (\$this->)setExpected(Exception\( \\?[a-z\\]+::class \);)
Replace: $1expect$2

Bug: T192167
Change-Id: I33a24d42b6dc1e126f32d5dbf41daa0bccb1414f
2019-10-05 17:39:46 +02:00
Timo Tijhof
01095f8075 Storage: SqlBlobStore no longer needs Lanugage object
Constructing a Language object in order to initialize the
BlobStoreFactory service causes a circular dependency
(see T231866).

SqlBlobStore was using the Language object to all iconv.
But nothing language specific is done in Language::iconv,
so we can just inline the call.

Bug: T231866
Change-Id: I90c25decbcff10ea762a2c7474a12fd2041b3abc
2019-10-02 09:26:34 -07:00
Petr Pchelko
fa36773e58 Introduce BlobStore::getBlobBatch method
Bug: T230834
Change-Id: I56306c50a6617dc91e4eb362ef010703ac25d951
2019-08-30 09:40:49 +00:00
Aaron Schulz
baafb5adb4 Make ExternalStore wrap ExternalStoreFactory and create access class
* Inject settings and global instances as dependencies to the
  ExternalStoreMedium instances. This includes the local wiki
  domain, so that wfWikiId() calls are not scattered around.
* Create ExternalStoreAccess service for read/write logic.
* Deprecate the ExternalStore wrapper methods.
* Add some exception cases for bogus store URLs are used instead
  of just giving PHP warnings and failing later.
* Make moveToExternal.php require the type/protocol to decide
  which ExternalStoreMedium to use instead of assuming "DB".
* Convert logging calls to use LoggerInterface.

Change-Id: I40c3b5534fc8a31116c4c5eb64ee6e4903a6197a
2019-06-28 14:31:44 -07:00
Fomafix
3ee1560232 No yoda conditions
Replace
  if ( 42 === $foo )
by
  if ( $foo === 42 )

Change-Id: Ice320ef1ae64a59ed035c20134326b35d454f943
2018-11-21 17:54:39 +01:00
Kunal Mehta
b4ea2d8c81 Disable PHPUnit tests that fail under postgres
So we can make the job voting, preventing other tests from regressing.
These tests can be re-enabled whenever they're made to pass.

Bug: T195807
Change-Id: I58261dd70eea3581803987a4a7739c7d55558f42
2018-08-01 22:22:15 +00:00
daniel
564257dc50 Blob can't be false
Change-Id: Ic06fcfaac71128c0ff7e9079685eac18206f2004
2018-06-20 17:32:35 +02:00
daniel
1b115fd022 Introduce SqlBlobStore::makeAddressFromTextId
This introduces a convenience method for constructing a blob address
from a text ID. It's the inverse of SqlBlobStore::getTextIdFromAddress

Change-Id: I31b3ee5e40185c754fb2c119eb5edc50b903f5dc
2018-04-19 17:23:59 +00:00
addshore
4b928c87dc Extra tests for SqlBlobStore with 'windows-1252' legacy encoding
Bug: T184749
Change-Id: Ida717dbe6ae742b3b61f0f09dc60712307c53a96
2018-01-24 22:08:46 +00:00
Umherirrender
84b9564e50 SqlBlobStoreTest: Use utf-8 as name in iconv
utf8 is an alias that doesn't work with all PHP installations.

Change-Id: I6ce9c5b4ece1a8c263afb1d4895dacd3c790a51a
2017-12-15 19:56:48 +01:00
Kunal Mehta
471ec51c93 Fix @covers tags to use absolute class names in Storage tests
PHPUnit doesn't support use statements when evaluating @covers tags.

Change-Id: I7f649afd3e417a6b71b2f61c6ff59be5f404be8f
2017-12-14 19:20:51 -08:00
addshore
06127159e8 [MCR] Tests for RevisionStore & Related classes
Code introduced in:
I140f43a6fb443b38483f41f268c906b9cea64cf7

Change-Id: Iefad870baf2d16f12e9901b303246c64d6431ca6
2017-12-14 13:44:55 +00:00