wiki.techinc.nl/tests/phpunit/unit/includes/libs/rdbms
Timo Tijhof 4ef0891994 rdbms: Consolidate logger channels into one
Notable changes:

* In SqlBagOStuff::getConnectionFromServerInfo, only two loggers were
  injected. The rest implicitly got a NullLogger due to being absent.
  These are now effectively unsilenced.

* Database::__construct() required almost all parameters, even the
  loggers. I've wanted to move some of DatabaseFactory into the ctor
  here for a while. In order to make this change not a breaking
  change, the new 'logger' parameter is optional with NullLogger as
  default. This allowed some of the test cases, which were simply
  passing NullLogger, to be fixed by passing nothing instead of
  passing the new option name.

  The Database class is behind a dozen layers of indirection for
  real use, so this will still be injected just fine (DBF, LB, LBF,
  MWLBF, etc.).

* In LegacyLogger, the handling for $wgDBerrorLog was previously
  limited to DBConnection and DBQuery. This now includes errors
  from other (generally, newer) parts of Rdbms as well, which were
  previously missing.

  This only affects sites (typically CI and dev setup) where
  $wgDBerrorLog is used, as opposed to the more common
  $wgDebugLogGroups by-channel configuration.

* TransactionProfiler gets its logger injected in a rather odd way,
  via entrypoints (MediaWiki.php, ApiMain.php, and MaintenanceRunner)
  as opposed to service wiring. This is kept as-is for now.

* In LBFactoryTest, in particular testInvalidSelectDBIndependent2,
  there are cases that intentionally produce failures of which
  the result is then observed. In CI we assert that dberror.log is
  empty so instead of adding the missing logger fields to that
  LBFactory instance, the only one set (replLogger) is removed.
  The alternative is to set 'logger' now, which would naturally
  cause CI failures due to unexpected entries coming through to
  non-mocked error log.

Bug: T320873
Change-Id: I7ca996618e41b93f488cb5c4de82000bb36e0dd3
2023-01-03 22:46:38 +00:00
..
connectionmanager Inline a few more trivial createMock() calls in tests 2022-08-08 09:50:50 +02:00
database rdbms: Consolidate logger channels into one 2023-01-03 22:46:38 +00:00
platform Fix whitespaces after comma 2022-12-15 01:24:14 +01:00
querybuilder rdbms: Allow SubQuery objects in SelectQueryBuilder as table 2022-09-12 09:56:31 +02:00
resultwrapper DBMS-specific ResultWrapper subclasses 2021-07-21 06:54:26 -07:00
AddQuoterMock.php rdbms: Start using SQLPlatform and move more methods there 2022-05-04 18:34:13 +00:00
ChronologyProtectorTest.php rdbms: Use JSON to store ChronologyProtector position data 2022-09-04 15:38:00 +00:00
SQLPlatformTestHelper.php rdbms: Move selectSQLText to SQLPlatform 2022-06-02 21:35:04 +02:00
TransactionProfilerTest.php rdbms: improve TransactionProfiler::silenceForScope() 2022-11-15 23:46:58 +00:00