function MigrateControllerTest::clickViewsOperationsLink

Same name and namespace in other branches
  1. 8.9.x core/modules/migrate_drupal_ui/tests/src/Functional/MigrateControllerTest.php \Drupal\Tests\migrate_drupal_ui\Functional\MigrateControllerTest::clickViewsOperationsLink()
  2. 10 core/modules/migrate_drupal_ui/tests/src/Functional/MigrateControllerTest.php \Drupal\Tests\migrate_drupal_ui\Functional\MigrateControllerTest::clickViewsOperationsLink()
  3. 11.x core/modules/migrate_drupal_ui/tests/src/Functional/MigrateControllerTest.php \Drupal\Tests\migrate_drupal_ui\Functional\MigrateControllerTest::clickViewsOperationsLink()

Clicks a view link to perform an operation.

Parameters

string $label: Text between the anchor tags of the link.

string $href_part: A unique string that is expected to occur within the href of the link.

Return value

bool TRUE when link found and clicked, otherwise FALSE.

1 call to MigrateControllerTest::clickViewsOperationsLink()
MigrateControllerTest::testUpgradeReport in core/modules/migrate_drupal_ui/tests/src/Functional/MigrateControllerTest.php
Tests the upgrade report with the view enabled, disabled and uninstalled.

File

core/modules/migrate_drupal_ui/tests/src/Functional/MigrateControllerTest.php, line 83

Class

MigrateControllerTest
Tests for the MigrateController class.

Namespace

Drupal\Tests\migrate_drupal_ui\Functional

Code

public function clickViewsOperationsLink($label, $href_part) {
    $links = $this->xpath('//a[normalize-space(text())=:label]', [
        ':label' => (string) $label,
    ]);
    foreach ($links as $link_index => $link) {
        $position = strpos($link->getAttribute('href'), $href_part);
        if ($position !== FALSE) {
            $index = $link_index;
            $this->clickLink((string) $label, $index);
            return TRUE;
        }
    }
    return FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.