Problem/Motivation
Currently., it is nos possible creating canonical, edit-form and delete-form URLs for the entity type "entity_test_mul_with_bundle".
Trying to create a phpunit test (any type) that uses the "entity_test_mul_with_bundle" entity type, has the following problem: when it is tried to generate its URL it throws the following error:
Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("entity_test_mul") to generate a URL for route "entity.entity_test_mul_with_bundle.canonical"
It would be nice to have this problem fixed so that contributed modules can make tests using a translatable entity type with bundles.
Steps to reproduce
- Create a phpunit test of any type
- Create a entity of type "entity_test_mul_with_bundle"
- Go to the entity
After following these steps, the error will be fired.
Proposed resolution
Change EntityTestMulWithBundle annotation links so instead of using entity_test_mul uses entity_test_mul_with_bundle.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | Screenshot_20231123_142630.png | 119.78 KB | omarlopesino |
Issue fork drupal-3403641
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3403641-tests-error-some
changes, plain diff MR !5515
Comments
Comment #3
omarlopesinoFixes are done, please review the MR.
In the gitlab CI build, the test-only step does not fail because this is a correction in one of the modules used for testing, So I've attached a screenshot of what happens when fixes are not one.
Comment #4
smustgrave commentedConfirmed I got the same failures as #3 locally.
Seems to be fixing a test stuff only and didn't break anything.
Comment #5
quietone commentedThanks for finding this and making an MR!
I think we need a title here that better reflects what is being fixed. Maybe 'Correct links for entity_test_mul_with_bundle'?
Also, this should have some review of the history to be sure that this is not an intended error in a test entity. A check should be done to see if anyone commented about the links in the issue. But more importantly is to check any testing done in that issue that may be using these links. The entity was added at #2571235-59: [regression] Roles should depend on objects that are building the granted permissions.
I am moving to the same component as the originating issue.
Comment #6
omarlopesinoComment #7
omarlopesinoThanks for the feedback!
I've fixed the title to explain what the exact problem is, and what the issue fixes. Let me know if it needs more explanation.
The entity class commit history is this:
- Class creation https://git.drupalcode.org/project/drupal/-/commit/cffb02aad63664e7930a3... . Issue related: https://www.drupal.org/project/drupal/issues/2571235
- Adding declare(strict_types=1): https://git.drupalcode.org/project/drupal/-/commit/489c3286ce9c4893fe824... . Issue related: https://www.drupal.org/project/drupal/issues/3400334
This entity is only used at core to check the content translation permissions: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/conte... . No URLs are used.
Conclusions:
Can you review again? Thanks!
Comment #8
omarlopesinoFixing the status.
Comment #9
smustgrave commented@omarlopesino excellent detail!
Comment #10
kristiaanvandeneyndeI'm actually on the fence if we even want the new test in core. It's pretty clear there was a mistake in the entity type annotation and link generation should already be well covered. I'd treat the test as a test-only thing for us to verify that everything is now fixed and leave it out when committing this.
Still RTBC and approved either way, just a note from a maintainer to a committer.
Comment #16
catchAgreed the test for the test module doesn't give us much here, this is very unlikely to regress once it's fixed.
Committed/pushed (minus the new test) to 11.x and cherry-picked back through to 10.3.x, thanks!
Comment #17
catchWrong status..