Change record: New 'Drupal\Core\DependencyInjection\ReverseContainer' service to replace DrupalKernel::getServiceIdMapping()

Since we're not using the old method, It's not clear to me why this error is showing up in tests. I suspect it's because we have Unit tests that do a lot of mocking (because they are too complicated and should probably be Kernel tests). If that's the case, we just have to mock this new service in the right places.

Comments

TR created an issue. See original summary.

tr’s picture

Priority: Normal » Major

Of the 130 remaining test failures, this issue seems to be responsible for 129.

Testing shows that these tests do not fail in Drupal 10.0, but only in 10.1 when the bc layer for this change was removed.

The only tests that fail are Unit tests, which is consistent with my suspicion above.

tr’s picture

Status: Active » Needs review
StatusFileSize
new2.42 KB

Experimenting with fixes - let's see what happens if we try this.

Because ReverseContainer didn't exist before D9.5, I expect we will have to add some conditional code to the tests to ensure they work with both D9 and D10. This patch doesn't have that conditional code, so what I'm primarily hoping for is that the ReverseContainer errors go away in the D10.1 tests.

Status: Needs review » Needs work

The last submitted patch, 3: 3346846-3-reverse-container.patch, failed testing. View results

tr’s picture

Status: Needs work » Needs review
StatusFileSize
new2.64 KB

Well that didn't work. Apparently because D10.1 uses the almost-fully-qualified class name Drupal\Core\DependencyInjection\ReverseContainer(without the initial "\") as a service ID instead of a regular service ID.

Let's try that again.

Status: Needs review » Needs work

The last submitted patch, 5: 3346846-5-reverse-container.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tr’s picture

Title: New 'Drupal\Core\DependencyInjection\ReverseContainer' service to replace DrupalKernel::getServiceIdMapping() » New 'Drupal\Component\DependencyInjection\ReverseContainer' service to replace DrupalKernel::getServiceIdMapping()
StatusFileSize
new2.45 KB

Ah, that didn't work either.

After all this I looked more closely and I discovered that although the change record and the core documentation say this class is:
Drupal\Core\DependencyInjection\ReverseContainer
it is actually:
Drupal\Component\DependencyInjection\ReverseContainer

So that was a waste of time. Trying a new patch with the correct class name ... I'll have to go in and edit the change record to make sure no one else wastes time on this.

tr’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: 3346846-7-reverse-container.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tr’s picture

Status: Needs work » Needs review
StatusFileSize
new2.46 KB

Status: Needs review » Needs work

The last submitted patch, 10: 3346846-10-reverse-container.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tr’s picture

Status: Needs work » Needs review
StatusFileSize
new2.47 KB

  • TR committed fc079d82 on 8.x-3.x
    Issue #3346846 by TR: New 'Drupal\Component\DependencyInjection\...
tr’s picture

Status: Needs review » Fixed

That fixed all the "ReverseContainer" errors in D9 and D10. There is 1 test fail left in D10, but that's a different issue entirely.

Committed with coding standards fix.

tr’s picture

Note, this only affected the TESTS and not the actual Rules code that would execute on a website.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.