function TMGMTTestBase::clickLinkWithImageTitle

Clicks on an image link with the provided title attribute.

Parameters

string $title: The image title.

File

src/Tests/TMGMTTestBase.php, line 225

Class

TMGMTTestBase
Base class for tests.

Namespace

Drupal\tmgmt\Tests

Code

function clickLinkWithImageTitle($title) {
  $urls = $this
    ->xpath('//a[img[@title=:title]]', [
    ':title' => 'Needs review',
  ]);
  if (empty($urls)) {
    $this
      ->fail('No image link with title' . $title . ' found');
    return;
  }
  $url_target = $this
    ->getAbsoluteUrl($urls[0]['href']);
  $this
    ->drupalGet($url_target);
}