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
For BC reasons we need a method assertNoTitle
on AssertLegacyTrait
as well as a new method on \Drupal\Tests\WebAssert
called titleNotEquals
Proposed resolution
Remaining tasks
Add a test for titleNotEquals
to \Drupal\FunctionalTests\BrowserTestBaseTest
Comments
Comment #2
dawehnerComment #3
dawehnerComment #4
eallison3 CreditAttribution: eallison3 commentedI'm working on this and hope to have a solution within the next few days.
Comment #5
eallison3 CreditAttribution: eallison3 at Sevaa Group commentedComment #6
dawehnerThat itself looks quite fine. One thing though what we should add is some level of test coverage ...
Comment #7
dawehnerComment #8
dawehnerAdded a remaining task description.
Comment #10
eallison3 CreditAttribution: eallison3 at Sevaa Group commentedAdded test for titleNotEquals to \Drupal\FunctionalTests\BrowserTestBaseTest
Comment #11
eallison3 CreditAttribution: eallison3 at Sevaa Group commentedComment #12
dawehnerThe test looks great!
What about quickly testing the BC layer as well here?
Comment #13
eallison3 CreditAttribution: eallison3 at Sevaa Group commentedAdded test for legacy assertNoTitle().
Comment #15
eallison3 CreditAttribution: eallison3 at Sevaa Group commentedLooks like the failed test was a false alarm.
Comment #16
dawehnerThank you!
Comment #17
alexpottI'm not sure I get the point of the method at all. I certainly don't think we should be putting it in
core/tests/Drupal/Tests/WebAssert.php
. If you look at the 2 usages in WebTestBase they are both preceded by an assertTitle() so it that works as expected then the assertNoTitle is pointless. I'd rather this patch removed those usages and debated about whether or not we should even be putting this in core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php because I'm not sure we should. This method was added in #345632: SimpleTest: correct assertTitle logic - for completeness.Negative assertions are tricky and I don't think our test system should be encouraging unnecessary ones.
Here are the current core usages (lol):
Comment #18
alexpottJust a thought - if we do go forward with this patch - two separate test installs of Drupal to essentially test the same assertion seems quite wasteful.
Comment #21
impalash CreditAttribution: impalash at Google Summer of Code commentedissue fixed for 8.6.x
Comment #22
impalash CreditAttribution: impalash commentedComment #23
dawehnerI agree with @alexpott on #18, let's merge the two test functions.
Comment #24
borisson_Fixed #18.
Comment #33
smustgrave CreditAttribution: smustgrave at Mobomo commentedBefore I start working on is this still needed for 9.5?
Would it be deprecated in 9.5 and removed in 10?
And it will need a CR?
Comment #36
smustgrave CreditAttribution: smustgrave at Mobomo commentedSince there was no follow up to #33 going to close for now.
But if still a valid task please please reopen
Thanks everyone!