You are here

public function ViewsExposedGroupsTestBase::clickExposedFormOptionsLink in Views exposed groups 7.2

Follows the exposed form options link by name.

Views wraps some links in spans, which means that clickLink is not possible to use.

Parameters

$label: Text between the anchor tags.

$index: Link position counting from zero.

Return value

mixed Page contents on success, or FALSE on failure.

1 call to ViewsExposedGroupsTestBase::clickExposedFormOptionsLink()
ViewsExposedGroupsInheritedPropertiesTest::testViewsUi in tests/views_exposed_groups_inherit.test
Asserts form sets values for inherited properties.

File

tests/views_exposed_groups.test, line 124
Views Exposed Groups UI Test.

Class

ViewsExposedGroupsTestBase
Base test class for views_exposed_groups module tests.

Code

public function clickExposedFormOptionsLink($label = '', $index = 0) {
  $url_before = $this
    ->getUrl();
  $urls = $this
    ->xpath('//a/span[normalize-space(text())=:label]/..', [
    ':label' => 'Grouped form',
  ]);
  if (isset($urls[$index])) {
    $url_target = $this
      ->getAbsoluteUrl($urls[$index]['href']);
    $this
      ->pass(t('Clicked link %label (@url_target) from @url_before', array(
      '%label' => $label,
      '@url_target' => $url_target,
      '@url_before' => $url_before,
    )), 'Browser');
    return $this
      ->drupalGet($url_target);
  }
  $this
    ->fail(t('Link %label does not exist on @url_before', array(
    '%label' => $label,
    '@url_before' => $url_before,
  )), 'Browser');
  return FALSE;
}