diff --git a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php index cae88dfca4f..82e98d91a89 100644 --- a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php +++ b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php @@ -221,7 +221,7 @@ class BrowserTestBaseTest extends BrowserTestBase { public function testInvalidLinkExistsExact() { $this->drupalGet('test-pipe-char'); $this->expectException(ExpectationException::class); - $this->expectExceptionMessage('Link with label foo|bar found'); + $this->expectExceptionMessage('Link with label foo|bar not found'); $this->assertSession()->linkExistsExact('foo|bar'); } @@ -253,7 +253,7 @@ class BrowserTestBaseTest extends BrowserTestBase { public function testInvalidLinkNotExistsExact() { $this->drupalGet('test-pipe-char'); $this->expectException(ExpectationException::class); - $this->expectExceptionMessage('Link with label foo|bar|baz not found'); + $this->expectExceptionMessage('Link with label foo|bar|baz found'); $this->assertSession()->linkNotExistsExact('foo|bar|baz'); } diff --git a/core/tests/Drupal/Tests/WebAssert.php b/core/tests/Drupal/Tests/WebAssert.php index f76c0790ae7..427a0a04964 100644 --- a/core/tests/Drupal/Tests/WebAssert.php +++ b/core/tests/Drupal/Tests/WebAssert.php @@ -294,7 +294,7 @@ class WebAssert extends MinkWebAssert { * Thrown when element doesn't exist, or the link label is a different one. */ public function linkExists($label, $index = 0, $message = '') { - $message = ($message ? $message : strtr('Link with label %label found.', ['%label' => $label])); + $message = ($message ? $message : strtr('Link with label %label not found.', ['%label' => $label])); $links = $this->session->getPage()->findAll('named', ['link', $label]); $this->assert(!empty($links[$index]), $message); } @@ -317,7 +317,7 @@ class WebAssert extends MinkWebAssert { * Thrown when element doesn't exist, or the link label is a different one. */ public function linkExistsExact($label, $index = 0, $message = '') { - $message = ($message ? $message : strtr('Link with label %label found.', ['%label' => $label])); + $message = ($message ? $message : strtr('Link with label %label not found.', ['%label' => $label])); $links = $this->session->getPage()->findAll('named_exact', ['link', $label]); $this->assert(!empty($links[$index]), $message); } @@ -338,7 +338,7 @@ class WebAssert extends MinkWebAssert { * Thrown when element doesn't exist, or the link label is a different one. */ public function linkNotExists($label, $message = '') { - $message = ($message ? $message : strtr('Link with label %label not found.', ['%label' => $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); } @@ -359,7 +359,7 @@ class WebAssert extends MinkWebAssert { * Thrown when element doesn't exist, or the link label is a different one. */ public function linkNotExistsExact($label, $message = '') { - $message = ($message ? $message : strtr('Link with label %label not found.', ['%label' => $label])); + $message = ($message ? $message : strtr('Link with label %label found.', ['%label' => $label])); $links = $this->session->getPage()->findAll('named_exact', ['link', $label]); $this->assert(empty($links), $message); } @@ -382,7 +382,7 @@ class WebAssert extends MinkWebAssert { */ public function linkByHrefExists($href, $index = 0, $message = '') { $xpath = $this->buildXPathQuery('//a[contains(@href, :href)]', [':href' => $href]); - $message = ($message ? $message : strtr('Link containing href %href found.', ['%href' => $href])); + $message = ($message ? $message : strtr('No link containing href %href found.', ['%href' => $href])); $links = $this->session->getPage()->findAll('xpath', $xpath); $this->assert(!empty($links[$index]), $message); } @@ -403,7 +403,7 @@ class WebAssert extends MinkWebAssert { */ public function linkByHrefNotExists($href, $message = '') { $xpath = $this->buildXPathQuery('//a[contains(@href, :href)]', [':href' => $href]); - $message = ($message ? $message : strtr('No link containing href %href found.', ['%href' => $href])); + $message = ($message ? $message : strtr('Link containing href %href found.', ['%href' => $href])); $links = $this->session->getPage()->findAll('xpath', $xpath); $this->assert(empty($links), $message); }