reverted: --- b/core/modules/simpletest/lib/Drupal/simpletest/Tests/WebTestBaseTest.php +++ /dev/null @@ -1,60 +0,0 @@ - 'WebTestBase helper functions test', - 'description' => 'Test helper functions provided by the WebTestBase class.', - 'group' => 'Simpletest', - ); - } - - /** - * Tests the behaviour of \Drupal\simpletest\WebTestBase::assertLink(). - */ - public function testAssertLink() { - $link_texts = array( - 'curry paste', - 'thai green curry paste', - 'Number\\9', - 'Number\9', - 'Number9', - 'Number9\\', - '$7@|{v$S', - ); - - // Set up some links to test. - $this->content = ''; - $this->plainTextContent = FALSE; - foreach ($link_texts as $link) { - $this->content .= '' . $link .''; - } - - // Add some text that is not a link. - $non_link_text = $this->randomName(4); - $this->content .= '

' . $non_link_text . '

'; - - foreach ($link_texts as $link) { - $result = $this->assertLink($link); - $this->assertTrue($result, 'The assertLink method found link.'); - } - - // Check that the non link text exists but is not a link. - $this->assertText($non_link_text); - $this->assertNoLink($non_link_text); - } - -} reverted: --- b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -1880,14 +1880,7 @@ // Return the string. $value = count($parts) > 1 ? 'concat(' . implode(', \'"\', ', $parts) . ')' : $parts[0]; } + $xpath = preg_replace('/' . preg_quote($placeholder) . '\b/', $value, $xpath); - - // Use preg_replace_callback so that if $value contains a string like "$1" - // this is not treated as a back reference. - $xpath = preg_replace_callback( - '/' . preg_quote($placeholder) . '\b/', - function ($matches) use ($value) { return $value; }, - $xpath - ); } return $xpath; }