Problem/Motivation
Automatic Updates makes heavy use of psr/log
's \Psr\Log\Test\TestLogger
class. It's a hell of a lot easier to use than mocking a logger, and it's very necessary for Automatic Updates to test unattended updates, which run during cron and therefore only output to a logger channel.
The problem is, that class was removed from psr/log 3, which is used by Drupal 10! It now lives, unchanged, in an independent package called colinodell/psr-test-logger
.
Although Automatic Updates could be refactored to use a mock logger, that would make the tests more complex, harder to read, and more painful to maintain.
Proposed resolution
Add colinodell/psr-test-logger to core's dev dependencies, after vetting it.
Remaining tasks
Decide if we're gonna do this, and if we are, submit a patchand commit it. As we do.- Unblock #3347306: Adopt TestLogger for testing logging
Dependency evaluation
Repository: https://github.com/colinodell/psr-testlogger
This is a very simple package. Fundamentally it is single class:
https://github.com/colinodell/psr-testlogger/blob/main/src/TestLogger.php
Code quality
The project has unit tests and automated coding standards.
Maintainership of the package
Maintained by a single maintainer Colin O'Dell. He is an experienced php open source maintainer and a member of thephpleague leadership team. See https://github.com/colinodell. This package should required very little maintenance.
Security policies of the package
This is a dev dependency, should only be used in test code. The project has a policy of security issues being reported privately https://github.com/colinodell/psr-testlogger#reporting-security-issues
Expected release and support cycles
None stated. Likely would need to adapt only to new php versions.
Other dependencies it'd add, if any
None.
Release notes snippet
colinodell/psr-testlogger
has been added to Drupal core's development dependencies.