Closed (fixed)
Project:
Drupal core
Version:
9.1.x-dev
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Sep 2018 at 06:35 UTC
Updated:
24 Jul 2020 at 17:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
ApacheEx commentedComment #3
nnevillComment #4
nnevillComment #5
lendude@nnevill nice!
We should add a test for this to
\Drupal\FunctionalTests\BrowserTestBaseTestI think, one scenario that passes and more importantly one that fails, so we have conformation that this actually detects duplicate IDs.Comment #6
ApacheEx commented@nnevill if you don't mind I'll help you with #5
1) I guess we don't need to check if there are any HTML IDs here
assertNoDuplicateIds. So, I removed this check (like in KernelTests)2) I've added tests (positon + negative) for
assertNoDuplicateIds.Comment #7
lendude@ApacheEx thanks as always!
Comment #8
alexpott@Lendude should this not go in \Drupal\Tests\WebAssert? And be accessed in tests via $this->assertSession()-> assertNoDuplicateIds() - maybe the method name needs to change.
Comment #9
lendude@alexpott yeah that makes sense! Moved it and renamed it.
Comment #10
ApacheEx commentedThis is even better version.
Looks good to me. All remarks were addressed.
Comment #11
alexpottUnused.
Let's use sprintf() to add the ID to the message.
Comment #15
saurabh.tripathi.cs commentedIf. Allow tests to compare MarkupInterface objects via assertEquals() has already been taken care of in 9.x than adding patch only for point mentioned in: #11
Comment #16
saurabh.tripathi.cs commentedIf we need a patch that has both changes. of. earlier patch #6 and #11 Use, this. patch.
Comment #18
hardik_patel_12 commentedSolving failed test cases. Kindly review a new patch.
Comment #19
lendudeMassive amount of unrelated changes introduced in #16 lets remove all those please.
Comment #20
hardik_patel_12 commentedRemoving unrelated changes introduced in #16 , and creating patch that has both changes as mentioned at #9 and #11. Kindly review new patch.
Comment #21
krzysztof domański1. I added a Change Record. The pageContainsNoDuplicateId assert was added to WebAssert.
2. Addressed #11.2 and added a test for it.
+ $this->expectExceptionMessage('The page contains a duplicate HTML ID "page-element".');3. I removed an unnecessary assert. It does nothing.
- $this->assert(TRUE, $message);Comment #23
krzysztof domańskiUnrelated random test failure.
Comment #25
krzysztof domańskiFixed coding standards.
Comment #26
hardik_patel_12 commentedI think all unrelated changes introduced in #16 is removed now , and rename from testAssertNoDuplicateIds to testPageContainsNoDuplicateId make sense also coding standards is proper now . So moving to RTBC.
Comment #27
krzysztof domańskiComment #28
krzysztof domańskiThere will be two the same asserts, but with a different name,
assertNoDuplicateIdsfor kernel andpageContainsNoDuplicateIdfor functional... They should be standardized.https://git.drupalcode.org/project/drupal/-/blob/9.0.x/core/tests/Drupal...
protected function assertNoDuplicateIds($message = '', $group = 'Other', $ids_to_skip = []) {Comment #29
catchCommitted 3c4c7a4 and pushed to 9.1.x. Thanks!
Comment #31
catchNot moving to 8.9/9.0 for backport. This is nice to have, but the patch doesn't result in a lot of test divergence so I think it's fine to just add it in 9.1.x
Comment #32
krzysztof domańskiBackport to 8.9/9.0 is not necessary, but it is helpful for another issue. See #2894747-37: Views hardcodes exposed filter block form ID's which breaks AJAX when the same form is shown multiple times on one page. Instead of adding another method to core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php, we could use the new method from WebAssert.