diff -u b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php --- b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php +++ b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php @@ -220,6 +220,7 @@ * * @deprecated Scheduled for removal in Drupal 9.0.0. * Use $this->assertSession()->fieldExists() or + * $this->assertSession()->buttonExists() or * $this->assertSession()->fieldValueEquals() instead. */ protected function assertFieldByName($name, $value = NULL) { @@ -239,6 +240,7 @@ * * @deprecated Scheduled for removal in Drupal 9.0.0. * Use $this->assertSession()->fieldNotExists() or + * $this->assertSession()->buttonNotExists() or * $this->assertSession()->fieldValueNotEquals() instead. */ protected function assertNoFieldByName($name, $value = '') { @@ -246,7 +248,7 @@ } /** - * Asserts that a field exists with the given ID and value. + * Asserts that a field exists with the given ID and val.ue. * * @param string $id * ID of field to assert. @@ -260,6 +262,7 @@ * * @deprecated Scheduled for removal in Drupal 9.0.0. * Use $this->assertSession()->fieldExists() or + * $this->assertSession()->buttonExists() or * $this->assertSession()->fieldValueEquals() instead. */ protected function assertFieldById($id, $value = '') { @@ -273,7 +276,8 @@ * Name or ID of field to assert. * * @deprecated Scheduled for removal in Drupal 9.0.0. - * Use $this->assertSession()->fieldExists() instead. + * Use $this->assertSession()->fieldExists() or + * $this->assertSession()->buttonExists() instead. */ protected function assertField($field) { $this->assertFieldByXPath($this->constructFieldXpath('name', $field) . '|' . $this->constructFieldXpath('id', $field)); @@ -286,7 +290,8 @@ * Name or ID of field to assert. * * @deprecated Scheduled for removal in Drupal 9.0.0. - * Use $this->assertSession()->fieldNotExists() instead. + * Use $this->assertSession()->fieldNotExists() or + * $this->assertSession()->buttonNotExists() instead. */ protected function assertNoField($field) { $this->assertNoFieldByXPath($this->constructFieldXpath('name', $field) . '|' . $this->constructFieldXpath('id', $field), NULL); @@ -410,6 +415,7 @@ * * @deprecated Scheduled for removal in Drupal 9.0.0. * Use $this->assertSession()->fieldNotExists() or + * $this->assertSession()->buttonNotExists() or * $this->assertSession()->fieldValueNotEquals() instead. */ protected function assertNoFieldById($id, $value = '') { @@ -574,16 +580,11 @@ } if ($found) { - throw new ExpectationException(new FormattableMarkup('The field resulting from :xpath was found with the provided value :value.', [ - ':xpath' => $xpath, - ':value' => $value, - ]), $this->getSession()->getDriver()); + throw new ExpectationException(sprintf('The field resulting from %s was found with the provided value %s.', $xpath, $value), $this->getSession()->getDriver()); } } else { - throw new ExpectationException(new FormattableMarkup('The field resulting from :xpath was found.', [ - ':xpath' => $xpath, - ]), $this->getSession()->getDriver()); + throw new ExpectationException(sprintf('The field resulting from %s was found.', $xpath), $this->getSession()->getDriver()); } } } @@ -613,7 +614,7 @@ foreach ($fields as $field) { if ($field->getAttribute('type') == 'checkbox') { // Checkbox with the correct checked state. - $found = $field->isChecked() == $value; + $found = $field->isChecked() === $value; } elseif ($field->getTagName() == 'select' && $field->find('xpath', '//option[@value = ' . (new Escaper())->escapeLiteral($value) . ' and @selected = "selected"]')) { // Select element with an option.