- Issue created by @longwave
- Status changed to Needs review
11 months ago 10:57pm 22 January 2024 - Status changed to RTBC
11 months ago 11:11am 23 January 2024 - π³π±Netherlands spokje
Code changes are minimal and make sense, so does the reasoning in the IS, green tests => RTBC
- Status changed to Needs work
11 months ago 11:52am 23 January 2024 - π¬π§United Kingdom longwave UK
Let's write a change record in case someone is overriding this for some reason and adding their own constructor.
- Status changed to Needs review
11 months ago 5:31pm 23 January 2024 - π¬π§United Kingdom longwave UK
Added BC, because we should be able to inject services if the container is available. As per deprecation policy we can link the message to the issue, not sure this is worth it's own CR, so linked it here.
- Status changed to Needs work
11 months ago 5:49pm 23 January 2024 - π³π±Netherlands spokje
Well....
The new BC triggers deprecation messages on basically every test using a container...
- Status changed to Needs review
11 months ago 6:16pm 23 January 2024 - π¬π§United Kingdom longwave UK
Yeah, that didn't work, there is a container available but it's not the right one. So a slightly uglier approach - if we explicitly pass NULL then that means we are in the installer, otherwise trigger the deprecation and BC layer.
https://3v4l.org/pcU1u implies this should be OK.
- Status changed to Needs work
11 months ago 6:37pm 23 January 2024 - π³π±Netherlands spokje
Besides adding some
NULL, NULL
tonew LoggerChannelFactory()
in\Drupal\Tests\media\Unit\ProviderRepositoryTest
and\Drupal\Tests\Core\Logger\LoggerChannelFactoryTest
, I think you're onto a winner. - Status changed to Needs review
11 months ago 10:54pm 23 January 2024 - π¬π§United Kingdom longwave UK
Fixed LoggerChannelFactoryTest as suggested.
Refactored ProviderRepositoryTest to inject a mock LoggerChannelFactory instead of a real object.
- Status changed to Needs work
11 months ago 6:58am 24 January 2024 - π³π±Netherlands spokje
PHPCS hates you...;)
#TheStruggleIsRealRefactored ProviderRepositoryTest to inject a mock LoggerChannelFactory instead of a real object.
Is this because we want to mock as much as possible in unit tests?
And in LoggerChannelFactoryTest we can't mock LoggerChannelFactory since it's the SUT?
- Status changed to Needs review
11 months ago 11:13am 24 January 2024 - π¬π§United Kingdom longwave UK
Fixed PHPCS.
Re #12, yes, in unit tests it is better to mock things that you aren't specifically testing. Here, we don't actually care what LoggerChannelFactory does internally, except that it needs to provide a LoggerChannel for the ProviderRepository to use - so we inject a mock that only does that. But in LoggerChannelFactoryTest, we actually want to test the functionality of LoggerChannelFactory itself, so we want a real object in order to prove that it behaves correctly.
Which made me think that I could also improve LoggerChannelFactoryTest: we might as well inject mock versions of the correct arguments, so I made that change.
- Status changed to RTBC
11 months ago 11:23am 24 January 2024 - π³π±Netherlands spokje
Nice, like the added mocked arguments.
All my (endless) moaning has been addressed, green tests => RTBC.
- π¬π§United Kingdom longwave UK
Also realised we can likely remove the NULL, NULL special case once π Remove dependency of "file_system" service on "logger" Needs work lands.
- Status changed to Needs work
10 months ago 11:15am 12 February 2024 - Status changed to Postponed
10 months ago 11:23am 12 February 2024 - π¬π§United Kingdom longwave UK
Let's postpone this on π Remove dependency of "file_system" service on "logger" Needs work as that makes this easier anyway.
- First commit to issue fork.
- Status changed to Needs review
10 months ago 9:31pm 26 February 2024 - π«π·France andypost
Rebased after π Fix install container definition of StreamWrapperManager Needs review
- Status changed to Needs work
10 months ago 3:04pm 27 February 2024 - π¬π§United Kingdom longwave UK
Following π Fix install container definition of StreamWrapperManager Needs review I think we can simplify this.
Unsure of the value of a change record here. The likelihood that someone is overriding the entire logger factory seems low to me. But for completeness it won't take long to write one.
- Status changed to Needs review
10 months ago 9:14pm 27 February 2024 - π«π·France andypost
Removed the condition, ++ to not add CR as we do all other places
- Status changed to Needs work
10 months ago 10:20pm 27 February 2024 - π¬π§United Kingdom longwave UK
As the request stack and current user are now always available, we can always inject them into the created LoggerChannel.
- Status changed to Needs review
10 months ago 1:22pm 28 February 2024 - π«π·France andypost
I bet we should provide BC to allow old container to work for upgrades at least
- π¬π§United Kingdom longwave UK
The constructor will ensure the new properties are always set, so
$this->container
is no longer needed at all? - Status changed to RTBC
10 months ago 3:19pm 1 March 2024 - πΊπΈUnited States smustgrave
Injection seems fine.
Seems there's still open discussion about when to use a CR vs linking to a ticket. Not sure if that should hold up things so will go ahead and mark.
- Status changed to Needs work
10 months ago 4:03pm 1 March 2024 - Status changed to Needs review
10 months ago 4:53pm 1 March 2024 - Status changed to Needs work
9 months ago 1:09pm 13 March 2024 The Needs Review Queue Bot β tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide β to find step-by-step guides for working with issues.
- Status changed to Needs review
9 months ago 11:58pm 15 March 2024 - Status changed to RTBC
9 months ago 11:01pm 19 March 2024 - π¬π§United Kingdom longwave UK
Given there were no changes here, being bold and marking RTBC to get this back with other committers for re-review.
- Status changed to Needs work
9 months ago 8:00am 20 March 2024 - π¬π§United Kingdom alexpott πͺπΊπ
What's the plan for things like:
- https://git.drupalcode.org/project/toggle_channels/-/blob/8.x-1.x/src/Lo...
- https://git.drupalcode.org/project/tmgmt_smartling/-/blob/8.x-5.x/module...
- https://git.drupalcode.org/project/test_helpers/-/blob/1.4.x/src/Stub/Lo...
I think all of these will be broken after this change. At the very least we need a change record because I think we could allow this under the constructors are not API. But I think we need to consider BC here and what to do.
- Assigned to longwave
- π¬π§United Kingdom longwave UK
I think we can add BC for all of those cases, it might be a bit awkward but looks doable.
- Issue was unassigned.
- Status changed to Needs review
9 months ago 11:06pm 20 March 2024 - π¬π§United Kingdom longwave UK
Added BC and deprecations for calling
get()
without the constructor being called,setContainer()
being called, and$this->container
being accessed, which I think covers all the cases in #34.Out of time for now, still needs a change record.
- π¬π§United Kingdom longwave UK
@andypost good questions/suggestions, thank you - responded in MR
- Status changed to RTBC
9 months ago 5:50pm 21 March 2024 - π«π·France andypost
Thank you! Then it's ready, follow-up to remove bc can be filled later
- Status changed to Fixed
9 months ago 7:17pm 21 March 2024 - π¬π§United Kingdom catch
The bc layer is tricky but we get to remove it in the 11.x branch soon, which is good. Committed/pushed to 11.x and cherry-picked to 10.3.x, thanks!
After committing this, I realised it was tagged for a change record and didn't have one. I'm not really convinced we should add change records for constructor deprecations, we're already going above and beyond providing bc for code that supposed to be @internal, but since we know in this case that contrib will be affected, went ahead and added https://www.drupal.org/node/3432835 β
Automatically closed - issue fixed for 2 weeks with no activity.