Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
This started out to remove an unused variable and that lead to discovery that the test wasn't working as advertised. See #7.
Original report:
In core/modules/migrate/tests/src/Unit/process/MenuLinkParentTest.php, $parent_link_path
variables are never used.
Proposed resolution
Fix the text so that is properly tests all three situations.
And remove the unused variable.
Remaining tasks
Review
Comment | File | Size | Author |
---|---|---|---|
#14 | after-patch.png | 11.87 KB | sulfikar_s |
#13 | 3172116-11.patch | 1.31 KB | quietone |
#9 | interdiff_7-9.txt | 841 bytes | raman.b |
#9 | 3172116-9.patch | 1.53 KB | raman.b |
#7 | interdiff-2-7.txt | 580 bytes | naresh_bavaskar |
Comments
Comment #2
shetpooja04 CreditAttribution: shetpooja04 at QED42 commentedCommit ID: 244ccb28
Link: https://git.drupalcode.org/project/drupal/-/commit/244ccb28632ed87155d8b22a147fb362a058ffaa
File: core/modules/migrate/tests/src/Unit/process/MenuLinkParentTest.php Line: 91
For Issue: https://www.drupal.org/project/drupal/issues/2845485 the variables were added
$parent_link_path variable were removed
Please review
Comment #4
SpokjeBack to NR after #3 turned out to be a random fail.
Comment #5
quietone CreditAttribution: quietone as a volunteer commentedPart of me likes having the 3rd value in the input array because this is a process plugin that expects three values but yes, it isn't needed. The source data for this is from the dataprovider, providerTransformException. So, if we are only going to use two variables then the data provider should only provide two. Setting to NW to also update the data provider.
Comment #6
naresh_bavaskarComment #7
naresh_bavaskarPlease review
Comment #8
quietone CreditAttribution: quietone as a volunteer commented@naresh_bavaskar, thanks for the patch and interdiff.
This change removes a test case which we want to keep. Want needs to happen is to modify each test case to provide two parameters instead of three. That will avoid the unused variable.
The PHPUnit docs explain how dataProviders work.
Comment #9
raman.b CreditAttribution: raman.b at OpenSense Labs commentedRemoving the third parameter from data provider and reverting the removed test case from #7
Comment #10
quietone CreditAttribution: quietone as a volunteer commentedYes, that looks correct.
I applied that patch and check the changed manually as well looking at the interdiff. There are no coding standard errors reported by testing.
This is good to go.
Thanks!
Comment #11
alexpottThis is now really odd the source_value is the same for both tests. I guess this is why the previous patch removed it.
I think we need to check whether these tests are really testing what we think they are.
Comment #13
quietone CreditAttribution: quietone as a volunteer commented@alexpott, thanks. Yes, that isn't right.
This now fixes the test to do what it should have been doing all along. It now properly tests all three paths that can cause the exception to be thrown. No interdiff because this is so small.
Change the title to show that a test is being changed.
Comment #14
sulfikar_s CreditAttribution: sulfikar_s at Zyxware Technologies commentedHi, I've applied the patch in #13 and it applied cleanly.
Also verified that the values for 'source_value' are now different for the three cases.
So RTBC.
Comment #15
quietone CreditAttribution: quietone as a volunteer commented@sulfikar_s, thanks for reviewing this patch! Instead of attaching an image that you applied the patch locally it is OK to comment 'I applied the patch and .. then explain what you did in the review. The community know the patch will apply because the test bot ran the tests.
Comment #16
alexpottCommitted and pushed b3d61bd368 to 9.2.x and b9d7fac590 to 9.1.x. Thanks!
Backported to 9.1.x as this is a test fix.
@sulfikar_s - thank you for looking into this issue. Posting screenshots of your codebase or CLI does not advance the issue, since the automated testing infrastructure tells us whether the patch applies correctly. So, I've removed the issue credit for that screenshot. In the future, you can get credit for issues by reading the issue to understand its purpose, and posting your review or testing of that purpose. Thank you!