diff --git a/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php index ee139d9..33eea7f 100644 --- a/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php +++ b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php @@ -205,7 +205,7 @@ protected function assertLink($label, $index = 0) { } /** - * Passes if a link with the specified label is found. + * Passes if a link with the specified label is not found. * * An optional link index may be passed. * @@ -228,7 +228,7 @@ protected function assertNoLink($label) { * Link position counting from zero. * * @deprecated Scheduled for removal in Drupal 9.0.0. - * Use $this->assertSession()->LinkByHref() instead. + * Use $this->assertSession()->linkByHref() instead. */ protected function assertLinkByHref($href, $index = 0) { $this->assertSession()->linkByHrefExists($href, $index); @@ -243,7 +243,7 @@ protected function assertLinkByHref($href, $index = 0) { * Link position counting from zero. * * @deprecated Scheduled for removal in Drupal 9.0.0. - * Use $this->assertSession()->LinkByHref() instead. + * Use $this->assertSession()->linkByHrefNotExists() instead. */ protected function assertNoLinkByHref($href, $index = 0) { $this->assertSession()->linkByHrefNotExists($href, $index); @@ -332,7 +332,7 @@ protected function assertEscaped($raw) { } /** - * Passes if the raw text IS NOT found escaped on the loaded page, fail otherwise. + * Passes if the raw text is not found escaped on the loaded page. * * Raw text refers to the raw HTML that the page generated. * diff --git a/core/tests/Drupal/Tests/WebAssert.php b/core/tests/Drupal/Tests/WebAssert.php index 5c270d9..972d086 100644 --- a/core/tests/Drupal/Tests/WebAssert.php +++ b/core/tests/Drupal/Tests/WebAssert.php @@ -218,8 +218,6 @@ public function linkExists($label, $index = 0, $message = '') { * * @param string|\Drupal\Component\Render\MarkupInterface $label * Text between the anchor tags. - * @param int $index - * Link position counting from zero. * @param string $message * (optional) A message to display with the assertion. Do not translate * messages: use strtr() to embed variables in the message text, not @@ -229,8 +227,6 @@ public function linkExists($label, $index = 0, $message = '') { * Thrown when element doesn't exist, or the link label is a different one. */ public function linkNotExists($label, $message = '') { - // Cast MarkupInterface objects to string. - $label = (string) $label; $message = ($message ? $message : strtr('Link with label %label found.', ['%label' => $label])); $links = $this->session->getPage()->findAll('named', ['link', $label]); $this->assert(empty($links), $message); @@ -240,7 +236,7 @@ public function linkNotExists($label, $message = '') { * {@inheritdoc} */ public function fieldValueEquals($field, $value, TraversableElement $container = NULL) { - parent::fieldValueEquals($field, (string) $value, $container); + parent::fieldValueEquals($field, $value, $container); } /** @@ -260,7 +256,6 @@ public function fieldValueEquals($field, $value, TraversableElement $container = * Thrown when element doesn't exist, or the link label is a different one. */ public function linkByHrefExists($href, $index = 0, $message = '') { - // Cast MarkupInterface objects to string. $xpath = $this->buildXPathQuery('//a[contains(@href, :href)]', [':href' => $href]); $message = ($message ? $message : strtr('Link containing href %href found.', ['%href' => $href])); $links = $this->session->getPage()->findAll('xpath', $xpath); @@ -316,7 +311,7 @@ public function buildXPathQuery($xpath, array $args = array()) { foreach ($args as $placeholder => $value) { // Cast MarkupInterface objects to string. if (is_object($value)) { - $value = (string) $value; + throw new \InvalidArgumentException('Just pass in scalar values.'); } // XPath 1.0 doesn't support a way to escape single or double quotes in a // string literal. We split double quotes out of the string, and encode