Commit graph

22 commits

Author SHA1 Message Date
Umherirrender
134045b9aa tests: Swap assertion order in unit tests
Changes from patch set Icb93c79f4843b59dae80d3eda1a880457a1a68f2
Also some swaps from assertEquals to assertSame/True/False/Null

Change-Id: Ife497ae6cb1888b77eb25e85b76df72adc65641a
2021-08-04 20:21:01 +02: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
f736c353d0 Simplify PagePropsTest
Use MediaWikiIntegrationTestCase::getExistingTestPage instead
of custom helper method createPage(), and remove unneeded
setting of globals

Change-Id: I63c4cd5a62d0c901cca596b4a52490153271f0c6
2021-05-03 14:42:27 +00:00
James D. Forrester
df5eb22f83 Replace uses of DB_MASTER with DB_PRIMARY
Just an auto-replace from codesniffer for now.

Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
2021-04-29 09:24:31 -07:00
Daniel Kinzler
b4021ea484 Re-apply "PageProps: use PageIdentity instead of Title""
This re-applies I15cc5a64d7fcc3d09f9175a3ca8dd8180761f085
This reverts the revert in af71ce1864.

Reason for revert: should no longer fail with Title::assertProperPage no longer checking for fragments.

Change-Id: I60b8cd14c8304ad34a69e22b978fa476430a867c
2021-04-28 16:43:51 +00:00
Gergő Tisza
af71ce1864 Revert "PageProps: use PageIdentity instead of Title"
This reverts commit 07d885248b.

Reason for revert: breaks tests in weird and unexpected ways

Bug: T279796
Bug: T281180
Change-Id: Iedc12256c8cd17498bcc12e184a12acbe5f2ac3b
2021-04-26 20:30:43 +00:00
daniel
07d885248b PageProps: use PageIdentity instead of Title
Bug: T279796
Change-Id: I15cc5a64d7fcc3d09f9175a3ca8dd8180761f085
2021-04-24 17:40:06 +02:00
Matěj Suchánek
51642e0aae Replace tabs with spaces
Change-Id: Id034c34a294585f58dba58c26db466e0e39cb557
2020-09-04 18:04:07 +02:00
Cindy Cicalese
e5c1002a5e Support use of TitleArray
Change-Id: Ic0394389f7f9fc403b73945af5e7f22f4f2c0641
2020-09-01 12:15:29 -04:00
DannyS712
cf2c2a0778 Tests: Replace ::doDeleteArticle with WikiPage::doDeleteArticleReal
Not including WikiPageDbTestBase, which is testing the method

Bug: T248000
Change-Id: I1848a79be9e25759654053e88ef956269342f588
2020-03-25 11:34:17 -07:00
Timo Tijhof
b4c5529890 PageProps: Minor clean up logic of PagePropsTest
* Remove mention of the once-new-now-deprecated assertArraySubset()
  method of PHPUnit.

* Rename private "the_properties" to use camelCase and have a
  clearer name in relation to "$properties" (actual vs expected).

* Avoid dynamically computing the expected values at run time.
  In particular I found array_replace_recursive() making the
  test hard to review for correctness.

  Previously, it changed our expected properties to contain the
  additional properties from the actual return value, and then
  compared the two, which is somewhat confusing, since those
  values are not actually what we gave the test nor what we
  care about.

  Instead use the expectedProperties array unmodified, and
  run the assertion only on the subset of keys we want to assert.

Change-Id: I526d8a47296adcb84ed427639e149e69a83c8280
2020-03-06 20:34:02 +00:00
Thiemo Kreuz
78ca9eff4a Remove duplicate variable name from class property PHPDocs
Repeating the variable name doesn't do anything. Documentation
generators don't need it. It's more stuff to read that doesn't add new
information. And it can become outdated.

Note there are two types of @var docs. When used inline (and not on a
class property) the variable name is needed.

Change-Id: If5a520405efacd8cefd90b878c999b842b91ac61
2019-12-02 12:58:29 +00:00
Max Semenik
48a323f702 tests: Add explicit return type void to setUp() and tearDown()
Bug: T192167
Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43
Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
2019-10-30 14:31:22 -07:00
Aryeh Gregor
2e1ac38485 Mass conversion to NamespaceInfo
Change-Id: I2fef157ceec772f304c0923a1cd8c0eef2e82a0f
2019-05-07 22:44:56 +02:00
Aryeh Gregor
63d7f2ad13 Automatically reset namespace caches when needed
This avoids error-prone code written separately in every test.  In
addition to no existing tests resetting the TitleFormatter (more
services probably need to be reset as well), they mostly reset only the
namespace cache on $wgContLang, which wouldn't help for any other
language.

The parser test runner still doesn't do this, but maybe it should.

Change-Id: I44b7a1aec48f14b0950907fa14bd0df80f674296
2018-08-01 16:30:08 +03:00
Kunal Mehta
0c77841534 Add @covers tags to miscellaneous tests
Change-Id: I7e65c1734aef01cd6395ee65204a0158d1635b0c
2017-12-24 23:29:00 -08:00
Umherirrender
29323f5622 Fix test class names to match convention
The test class should have Test at end
and same name as the testing class

Change-Id: Id0c90994d257fb325834e123b462f7f0849ac556
2017-12-10 11:41:59 +01:00
Brad Jorsch
2d9f29a846 Improve namespace handling in tests
MWNamespace has three internal caches, only one of which can be cleared
(and that somewhat oddly by passing a boolean to
MWNamespace::getCanonicalNamespaces()).

This change introduces a MWNamespace::clearCaches() method to clear all
three caches. It also adds some resetting in tests that seemed to be
missing it.

Change-Id: I1dcfcd8713888b3ff8fc75e95329ba72bd95d0c9
2017-09-29 05:21:47 +00:00
umherirrender
34fe90ac52 Remove empty lines at end of functions
It looks like there is something missing after the last statement
Also remove some other empty lines at begin of functions, ifs or loops
while at these files

Change-Id: Ib00b5cfd31ca4dcd0c32ce33754d3c80bae70641
2016-11-05 11:55:10 +01:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Cindy Cicalese
86c08b2401 Converted ApiQueryPageProps to use PageProps; added multi-property query to PageProps.
Change-Id: Icd4540001e044052ae5759c87c8b83a70ab5c30f
2016-02-16 13:39:47 -05:00
Cindy Cicalese
e48030a7ae Add page_props table access class
Bug:T115331
Change-Id: I022b9e3ca47dc63650b8a62260603b0893a80e69
2016-01-15 03:51:57 +00:00