diff --git a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
index 81e4cdf98e..e5dd642fb0 100644
--- a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
+++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
@@ -60,12 +60,12 @@ public function testList() {
'url' => $entity->toUrl()->setOption('query', $this->getRedirectDestination()->getAsArray()),
],
'disable' => [
- 'title' => t('Disable ""Default""'),
+ 'title' => t('Disable "Default"'),
'weight' => 40,
'url' => $entity->toUrl('disable')->setOption('query', $this->getRedirectDestination()->getAsArray()),
],
'delete' => [
- 'title' => t('Delete ""Default""'),
+ 'title' => t('Delete "Default"'),
'weight' => 100,
'url' => $entity->toUrl('delete-form')->setOption('query', $this->getRedirectDestination()->getAsArray()),
],
diff --git a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php
index 5b7b6164c7..977055ff68 100644
--- a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php
+++ b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php
@@ -293,7 +293,7 @@ public function testMultipleSearchPages() {
$this->verifySearchPageOperations($second_id, TRUE, TRUE, TRUE, FALSE);
// Change the default search page.
- $this->clickLink(t('Set as default'));
+ $this->clickLink(t('Set "@label" as default', ['@label' => $second['label']]));
$this->assertRaw(t('The default search page is now %label. Be sure to check the ordering of your search pages.', ['%label' => $second['label']]));
$this->verifySearchPageOperations($first_id, TRUE, TRUE, TRUE, FALSE);
$this->verifySearchPageOperations($second_id, TRUE, FALSE, FALSE, FALSE);
diff --git a/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php
index a587f47aad..6cb8c6a49d 100644
--- a/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php
@@ -95,6 +95,7 @@ public function testDefaultViews() {
// Duplicate a view and set a custom name.
$this->drupalGet('admin/structure/views');
$this->clickViewsOperationLink(t('Duplicate view "@label"', ['@label' => 'Glossary']), '/glossary');
+ $this->assertUrl('admin/structure/views/view/glossary/duplicate');
$random_name = strtolower($this->randomMachineName());
$this->drupalPostForm(NULL, ['id' => $random_name], t('Duplicate'));
$this->assertUrl("admin/structure/views/view/$random_name", [], 'The custom view name got saved.');
@@ -215,34 +216,31 @@ public function testPathDestination() {
* various views listing pages, and they might have tokens in them. So we
* need special code to find the correct one to click.
*
- * @param $label
+ * @param string $label
* Text between the anchor tags of the desired link.
- * @param $unique_href_part
+ * @param string $unique_href_part
* A unique string that is expected to occur within the href of the desired
* link. For example, if the link URL is expected to look like
* "admin/structure/views/view/glossary/*", then "/glossary/" could be
* passed as the expected unique string.
*
- * @return
+ * @return object|bool
* The page content that results from clicking on the link, or FALSE on
* failure. Failure also results in a failed assertion.
*/
public function clickViewsOperationLink($label, $unique_href_part) {
- $links = $this->xpath('//a[normalize-space(text())=:label]', [':label' => (string) $label]);
- foreach ($links as $link_index => $link) {
+ // Remove HTML with their content and trim the label just
+ // like normalize-space() and text() are doing in the xpath query.
+ $operation_label = trim(preg_replace('@<(\w+)\b.*?>.*?\1>@si', '', (string) $label));
+ $links = $this->xpath('//a[normalize-space(text())=:label]', [':label' => $operation_label]);
+ foreach ($links as $link) {
$position = strpos($link->getAttribute('href'), $unique_href_part);
if ($position !== FALSE) {
- $index = $link_index;
- break;
+ return $link->click();
}
}
- $this->assertTrue(isset($index), format_string('Link to "@label" containing @part found.', ['@label' => $label, '@part' => $unique_href_part]));
- if (isset($index)) {
- return $this->clickLink((string) $label, $index);
- }
- else {
- return FALSE;
- }
+ $this->fail(format_string('Link to "@label" containing @part found.', ['@label' => $label, '@part' => $unique_href_part]));
+ return FALSE;
}
}