Problem/Motivation
AssertLegacyTrait:: assertFieldByName and :assertNoFieldByName is deprecated and will be removed in Drupal 10.
There is a total of 17 occurrences which needs to be reviewed and replaced.
Steps to reproduce
Proposed resolution
These will need to be replaced by one of the following assertion methods:
$this->assertSession()->fieldExists()
$this->assertSession()->fieldNotExists()
$this->assertSession()->fieldValueEquals()
$this->assertSession()->fieldValueNotEquals()
Examples:
Before (fieldValue(Not)Equals):
$this->assertFieldByName('title|0|value[translation][value]', $text . 'translated');
$this->assertNoFieldByName('body|deep_nesting[translation][value]', $text . 'no save');
After:
$this->assertSession()->fieldValueEquals('title|0|value[translation][value]', $text . 'translated');
$this->assertSession()->fieldValueNotEquals('body|deep_nesting[translation][value]', $text . 'no save');
Before (field(Not)Exists):
$this->assertFieldByName('embedded_fields[node][entity_test_t_composite]');
$this->assertNoFieldByName('job_type');
After:
$this->assertSession()->fieldExists('embedded_fields[node][entity_test_t_composite]');
$this->assertSession()->fieldNotExists('job_type');
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
larisse commentedHi! Here's a patch to fix this.
In the files
ContentEntitySourceTranslatableEntityTest.phpandTMGMTUiReviewTest.php, theassertFieldByNameneeds 2 parameters and I don't sure if I can put 'NULL' or ' ', so I just don't fixed this.The same occur to
ContentEntitySourceTranslatableEntityTest.phpandTMGMTUiReviewTest.phpforassertFieldByNamefunction.Comment #3
marcusml commentedThanks again larisse! The occurrences in
ContentEntitySourceTranslatableEntityTest.phpandTMGMTUiReviewTest.phpneeded to be replaced with$this->assertSession()->fieldExists().Here's a patch which includes the missing two.
Comment #4
berdirThis needs a reroll as well.
Comment #5
marcusml commentedRerolled.
Comment #6
berdirCommitted.