- Issue created by @mondrake
- 🇮🇹Italy mondrake 🇮🇹
In this case, the user is anyway informed about the issue via the 400 response with the message. The point is whether we want to track the same message for site admin. If we use
trigger_error()
, the error will only be logged if the setting allows, which is not recommended in prod sites. So it'd be better log it directly via a service, if the container is available? - Status changed to Needs review
11 months ago 10:53pm 7 February 2024 - Status changed to Needs work
11 months ago 3:13pm 12 February 2024 - Status changed to Needs review
10 months ago 10:46am 16 February 2024 - Status changed to RTBC
10 months ago 7:31pm 16 February 2024 - Status changed to Needs review
10 months ago 12:14am 29 February 2024 - 🇬🇧United Kingdom alexpott 🇪🇺🌍
This feels so wrong. Our test infrastructure should not be stopping us from using trigger_error. There has to be a better way.
- 🇮🇹Italy mondrake 🇮🇹
@alexpott re #10 we could backfill the
expect[Error|Warning]*()
methods, but current position is NOT to do that and abide by PHPUnit 10 approach that simply makestrigger_error()
untestable.Discussion in https://drupal.slack.com/archives/C1BMUQ9U6/p1707946428463489
- Status changed to RTBC
10 months ago 11:17am 29 February 2024 - 🇬🇧United Kingdom alexpott 🇪🇺🌍
Discussed a bit with @catch.
I'm not a big fan of PHPUnit making us change run-time code - it feels the wrong way around. But in this specific case I think the changes are an improvement - and maybe that will turn out to be the case with all trigger_error stuff.
- 🇬🇧United Kingdom alexpott 🇪🇺🌍
One point that @catch makes is that logger channels are not lazy. So we have to instantiate services in order to inject something that is rarely used.
- Status changed to Needs work
10 months ago 1:48pm 29 February 2024 - 🇬🇧United Kingdom catch
Yes the reason to not inject loggers everywhere is because if they're logging errors it's for a 1/10000 event, and they have dependencies that also then need to be instantiated like the database layer.
Discussed this with @alexpott in slack and he mentioned service closures. There's a good example of that being used in 📌 Remove ContainerAwareTrait from session middleware Fixed , so I think we can do that.
I'm personally not convinced that completely dropping expectError is going to help us, because phpunit has also dropped support for what symfony-phpunit bridge does for @trigger_error() too - so will we do a lot of work and still be stuck? Might need a meta issue. However, that doesn't mean we can't go ahead here as long as the service is lazily instantiated.
- 🇮🇹Italy mondrake 🇮🇹
@catch 📌 Upgrade PHPUnit to 10, drop Symfony PHPUnit-bridge dependency Fixed is taking care of replacing the bridge deprecation reporting features that will not be ported to PHPUnit 10. That is (mostly) working already. In there, we could easily backfill
expect[Error|Warning]*()
methods, and in fact earlier versions of the MR had that in place; lately though, that part was dropped based on the Slack discussion in #11. - 🇮🇹Italy mondrake 🇮🇹
@alexpott @catch @longwave mind moving the discussion on what to do with expect[Error|Warning]*() to 📌 Upgrade PHPUnit to 10, drop Symfony PHPUnit-bridge dependency Fixed ?
- Assigned to mondrake
- Issue was unassigned.
- Status changed to Needs review
10 months ago 5:46pm 29 February 2024 - Status changed to RTBC
10 months ago 5:11pm 7 March 2024 - 🇺🇸United States smustgrave
Appears all feedback has been addressed so going to remark
- 🇬🇧United Kingdom alexpott 🇪🇺🌍
This fix is so elegant - we should make more use of service enclosures for logging.
- Status changed to Fixed
10 months ago 5:25pm 7 March 2024 - 🇬🇧United Kingdom alexpott 🇪🇺🌍
Committed and pushed 25697a17e8 to 11.x and 5959b69d70 to 10.3.x. Thanks!
-
alexpott →
committed 5959b69d on 10.3.x
Issue #3419693 by mondrake, alexpott, smustgrave, catch: Log error...
-
alexpott →
committed 5959b69d on 10.3.x
-
alexpott →
committed 25697a17 on 11.x
Issue #3419693 by mondrake, alexpott, smustgrave, catch: Log error...
-
alexpott →
committed 25697a17 on 11.x
Automatically closed - issue fixed for 2 weeks with no activity.