Commit graph

28 commits

Author SHA1 Message Date
Umherirrender 96ef4cfd2d Migrate to IReadableDatabase::newSelectQueryBuilder
Also use expression builder to avoid raw sql

Bug: T312333
Change-Id: I6ce22de6637fccca8cf86a405bc023f268ff693b
2024-04-28 01:05:10 +02:00
Novem Linguae c71d826ede Remove $this->tablesUsed from PHPUnit tests
Deprecated in T342301 in v1.41. This is now tracked
automatically. The variable can be safely deleted.

Change-Id: I3864ee85e8b0ff74385eee88018a37f61927f5ef
2024-01-14 04:48:27 -08:00
Daimona Eaytoy 7b1a9582b2 Make DB tests more robust
In EventMapperTest, suppress notifications created by calling
getExistingTestPage. So far, this test only worked because the existing
test page is created in addCoreDBData (and not inside the test), but
this will no longer be the case after core change
I308617427309815062d54c14f3438cab31b08a73. Clear the PageSaveComplete
hook handlers to prevent that.

DiscussionParser has a static cache of revision data that can become
stale when data is deleted between tests (because revision IDs can be
reassigned to different pages, similar to T344124). This cache seems
needed, and converting the class to a service seems hard, so add the
page title to the cache key to try and avoid collisions. This can still
break if two tests are using the same page, which is hopefully quite
unlikely.

Change-Id: Ic4cbd8ff424e1260544ff9754e0c89dd4bb2f733
2023-08-19 19:59:51 +00:00
Reedy 1bc5b6daf8 Namespace classes that need aliases
Change-Id: Ieeeaf80d04b060d6dbca1959d5e66f4c69c5a7f2
2023-08-18 19:00:41 +01:00
Umherirrender 9de512d59c tests: Resolve phpunit filename deprecation errors
PHPUnit wants the filenames of the tests to match the class name being
tested.

Bug: T337333
Change-Id: I44f626d1bfdf151fecafc29c51b2cf2bb90481b0
2023-08-12 21:07:15 +02:00
Umherirrender 36970ce54c tests: Call editPage() with WikiPage when used for same page
When calling editPage() with a string it converts it to a WikiPage each
time it is called. When edit a page only once that is okay,
but when adding more revision to the same page it is better to pass a
WikiPage instead to allow reuse of internal states of WikiPage to speed
up the tests

Change-Id: Iac4ef3a3838ba22cd98b944e3ac7f596d540b405
2023-07-15 22:32:16 +02:00
Reedy 5611662f06 Namespace Model
Depends-On: Id28792658de950b99a8786f881563476def59eba
Change-Id: Ib57ea2db947285946f31fa9912b37181044df9d3
2022-11-10 14:25:42 -07:00
jenkins-bot ec9ea8fc81 Merge "Tweaks to EchoTalkPageFunctionalTest" 2021-08-04 16:47:55 +00:00
libraryupgrader 17a644263a build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs are failing and were disabled:
  * PSR12.Functions.ReturnTypeDeclaration.SpaceBeforeReturnType

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* trim-newlines: 3.0.0 → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)

Change-Id: Id866782d39ac02a329bd79539f2d52392fffd296
2021-07-24 01:48:06 +00:00
Bartosz Dziewoński 762a2e192a Tweaks to EchoTalkPageFunctionalTest
* Fix off-by-one counting
* Fix asserting properties on the wrong event (first one instead of
  last one), luckily they are identical

Change-Id: Ib1a02476554b29b2a1d0bfdfa89859d71d7691b1
2021-07-21 23:25:54 +02:00
Bartosz Dziewoński 7dbc4f6ce8 TalkPageFunctionalTest: Only count our own events
We're working on code in DiscussionTools that generates Echo events for
adding talk page comments (I7e0996843cdd70141e19d5c7ce66122204efa1b7),
and it was causing this test to fail.

Change-Id: I3099473a3113962911b9c77ede290142857a51b2
2021-03-04 16:29:57 +00:00
Ostrzyciel a585ad635a Explicitly provide sysop user in unit tests that need it
Currently Echo assumes the default user used when ->editPage() is
called to be a sysop user… which is kind of the case? It passed null
to WikiPage::doEditContent() which in turn falls back to the default
user (127.0.0.1). In a test that relies on the user to be a sysop, it's
better to provide the user explicitly to avoid confusion.

This is to clean up the confusion introduced by ->editPage()'s doc
block, see: I9f77474f40e0f6901aa2c6f846e471b822636aa5

Change-Id: I7a79e0eaa1617e4d87a8d615a5391723c0e30b6a
2020-09-13 08:16:45 +00:00
Umherirrender 3c53d6acb9 phpcs: Break long lines
Use the codesniffer default of length = 120

Change-Id: Ifbfd56b20432e54805d3a9bce22cda888c1fc74d
2020-06-27 12:05:03 +02:00
Pppery db78c1552e Add support for watchlist events
Bug: T203941
Change-Id: I9bcd13cb0a547393696dde0e977b7761cc1fea68
2019-12-11 16:39:02 -05:00
James D. Forrester abaff73626 build: Upgrade mediawiki-codesniffer to v28.0.0
Change-Id: Ib66b0ad1b3929bf7e49eb40a3d5463b0d8b2280b
2019-10-10 09:29:24 +00:00
Stephane Bisson 3a7e655229 Unbreak TalkPageFunctionalTest
* Clear echo_event before the test. Otherwise it contains
  a 'thank-you-edit' event that offsets everything.
* Use standard $this->db
* Use standard ~~~~ signature

Bug: T67336
Change-Id: Idd09aa107d01038d03b689d9086f65a9fb7b653a
2019-04-19 14:17:01 -04:00
Umherirrender 1b5308ba81 Use explicit columns and avoid SELECT *
Change-Id: Ibde033784aee5adc13fae6f1d395d9464f54fefd
2019-03-02 22:39:53 +01:00
Umherirrender 1345b056c2 Add @group Database to unit test
Used database by inserting pages

Change-Id: If97d9e6e525465ca3879003e71dd5e67fc0afdfd
2018-09-14 22:29:34 +02:00
jenkins-bot af2b92856f Merge "Fix missing/mismatching type hints PHPDoc tags" 2018-08-16 08:39:29 +00:00
Thiemo Kreuz 2d7096bcff Fix missing/mismatching type hints PHPDoc tags
This fixes some issues I found while updating this code base, e.g.
this removes types a method really does not return.

Change-Id: I19457e7bf88945eec958bf53e0b76a7585715a45
2018-08-16 07:07:20 +00:00
Thiemo Kreuz c1c3c7b672 Make "@… array" type hints more specific
There are about 200 of such generic "array" type hints in this code base,
the majority in @param tags. I started with what I found most relevant:
@var and @return tags. I might continue working on this later, but
wanted to stop for now to keep this patch moderately small.

Change-Id: Iff0d9590a794ae0f885466ef6bb336b0b42a6cd3
2018-08-13 09:27:37 +02:00
Kosta Harlan da2da90b48 Re-enable test coverage reporting, add @covers tags
Bug: T195136
Change-Id: I9203232e79f162aedb982b713f708cebfe9d1ae0
2018-06-28 08:32:57 -04:00
libraryupgrader 7a23ddf4b0 build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
Change-Id: I7b19fab3b1100c4973600ec95ee24160e141c5ac
2017-09-24 09:49:43 +00:00
James D. Forrester 8c810dff48 build: Update mediawiki/mediawiki-codesniffer to 0.7.1
Also added "composer fix" command.

Change-Id: I25cb61b3b92798f1259d1575a336e2b056d5764f
2016-12-05 15:54:30 -08:00
Thiemo Mättig 27e1a986da Fix visibility of setUp methods in tests
Change-Id: Ib1c425b9934a8325a4338f160aafcf17216aa250
2015-12-14 11:02:34 +01:00
Siebrand Mazeland 33126b69aa Update formatting
In preparation of Code Sniffer based updates.

Change-Id: Id5d43332b44a37665d57dc24ef8c432bc65b2f6a
2015-10-03 23:28:54 -04:00
addshore a9be7abfbe Remove use of deprecated TestUser->user
Change-Id: I9b3e048f01551cffb6848410fa9515201cbb2d1f
2015-08-07 17:04:59 +01:00
Kunal Mehta c1c91a0c1d Update tests/phpunit for new directory structure
Change-Id: Ic2d5659bb1db89cb62d3703ce59f3e58ba909886
2015-06-15 11:36:02 -07:00
Renamed from tests/phpunit/includes/TalkPageFunctionalTest.php (Browse further)