Commit graph

8 commits

Author SHA1 Message Date
Umherirrender
167fb2a979 unit tests: Use MainConfigNames constant to refer configs
When creating ServiceOptions objects or fake HashConfigs use the
constant to refer the config name

Change-Id: I59a29f25b76e896c07e82156c6cc4494f98e64cc
2022-08-17 22:33:58 +02:00
Thiemo Kreuz
29aca66975 Fix visibility of setUp methods in tests
Change-Id: Iefc05b4f4a9c258a385a22fc8d87b29648900e44
2022-05-17 14:11:22 +02:00
Daimona Eaytoy
613a874635 rdbms: Add more return typehints
See full rationale at I59068cfed10aabf6c6002f9e9312a6ef6e7e9441.
Using IDatabase for now instead of DBConnRef for better BC.

Change-Id: Ie75aaf46ba91779e8706b10efeefa9580857f489
2021-09-07 08:23:36 +00:00
jenkins-bot
f7e6e6bcd2 Merge "Simplify and reduce duplication in PingbackTest" 2021-07-23 04:16:56 +00: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
85fa5602e3 Simplify and reduce duplication in PingbackTest
MediaWikiTestCaseTrait provides a helper method,
createNoOpMock, that covers the case of wanting
to assert that no methods or no methods except
those in a list get called.

Add a helper method for the repeated logic
of creating cache and config, and creating
and running the pingback.

Merge the two test cases for when a pingback
should actually be sent (no prior pingback in the
database, or the prior pingback is from more than a
month ago) to use a data provider.

Rename variables to be sligthly clearer.

Change-Id: I25daf4d78b7bea12a6bc68ace3827985e435d21d
2021-07-21 15:50:25 +00:00
DannyS712
438b3924b4 Reset fake timestamps for unit tests too
Discovered in another patch that while integration
tests automatically reset fake timestamps afterwards,
unit tests don't. Add a shared method to MediaWikiTestCaseTrait
to reset for both integration tests and unit tests

Do the same for TypeDefTestCase

Change-Id: I677aec4e60894053fc554f2e13b069fb599858f2
2021-04-14 21:01:33 +00:00
Timo Tijhof
43e3a6460b Pingback: Refactor for dependency injection and cover with tests
* Inject dependencies from the constructor and use those instead.

* Make getSystemInfo() static since its sole purpose is to collect
  global state. This also means it can be safely called from the
  Installer without needing to construct this class and its unsafe
  dependencies as the Installer was doing previously.

* Remove private 'id' member. This cached the fetchOrInsertId()
  return value but was never used.

* Remove selectField() fallback IGNORE-mode insert from fetchOrInsertId().
  This existed to handle concurrent writes, but this isn't possible
  since all this runs inside a DB_MASTER lock.

* Add missing call to $cache->makeKey().
  Avoid passing unformatted strings directly to BagOStuff methods.

Bug: T270540
Change-Id: I984526020ea4d5f0fd6f72b6be527edaf6ab0917
2020-12-22 19:13:53 +00:00