You are here

protected function AssertContentTrait::assertNoLink in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/AssertContentTrait.php \Drupal\simpletest\AssertContentTrait::assertNoLink()

Passes if a link with the specified label is not found.

Parameters

string|\Drupal\Component\Render\MarkupInterface $label: Text between the anchor tags.

string $message: (optional) A message to display with the assertion. Do not translate messages: use \Drupal\Component\Utility\SafeMarkup::format() to embed variables in the message text, not t(). If left blank, a default message will be displayed.

string $group: (optional) The group this message is in, which is displayed in a column in test output. Use 'Debug' to indicate this is debugging output. Do not translate this string. Defaults to 'Other'; most tests do not override this default.

Return value

bool TRUE if the assertion succeeded, FALSE otherwise.

43 calls to AssertContentTrait::assertNoLink()
BasicAuthTest::testBasicAuth in core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php
Test http basic authentication.
BlockUiTest::testBlockAdminUiPage in core/modules/block/src/Tests/BlockUiTest.php
Test block admin page exists and functions correctly.
BookTest::testBookExport in core/modules/book/src/Tests/BookTest.php
Tests book export ("printer-friendly version") functionality.
BookTest::testBookOutline in core/modules/book/src/Tests/BookTest.php
Tests outline of a book.
BreadcrumbTest::testBreadCrumbs in core/modules/system/src/Tests/Menu/BreadcrumbTest.php
Tests breadcrumbs on node and administrative paths.

... See full list

File

core/modules/simpletest/src/AssertContentTrait.php, line 332
Contains \Drupal\simpletest\AssertContentTrait.

Class

AssertContentTrait
Provides test methods to assert content.

Namespace

Drupal\simpletest

Code

protected function assertNoLink($label, $message = '', $group = 'Other') {

  // Cast MarkupInterface objects to string.
  $label = (string) $label;
  $links = $this
    ->xpath('//a[normalize-space(text())=:label]', array(
    ':label' => $label,
  ));
  $message = $message ? $message : SafeMarkup::format('Link with label %label not found.', array(
    '%label' => $label,
  ));
  return $this
    ->assert(empty($links), $message, $group);
}