You are here

protected function AdminMenuTestBase::assertElementByXPath in Administration menu 8.3

Check that an element exists in HTML markup.

Parameters

$xpath: An XPath expression.

array $arguments: (optional) An associative array of XPath replacement tokens to pass to DrupalWebTestCase::buildXPathQuery().

$message: The message to display along with the assertion.

$group: The type of assertion - examples are "Browser", "PHP".

Return value

TRUE if the assertion succeeded, FALSE otherwise.

4 calls to AdminMenuTestBase::assertElementByXPath()
AdminMenuDynamicLinksTest::testNode in lib/Drupal/admin_menu/Tests/AdminMenuDynamicLinksTest.php
Tests node type links.
AdminMenuLinkTypesTest::testLinkTypes in lib/Drupal/admin_menu/Tests/AdminMenuLinkTypesTest.php
Tests appearance of different router item link types.
AdminMenuPermissionsTest::testPermissions in lib/Drupal/admin_menu/Tests/AdminMenuPermissionsTest.php
Test that the links are added to the page (no JS testing).
AdminMenuTestBase::assertLinkTrailByTitle in lib/Drupal/admin_menu/Tests/AdminMenuTestBase.php
Asserts that links appear in the menu in a specified trail.

File

lib/Drupal/admin_menu/Tests/AdminMenuTestBase.php, line 46

Class

AdminMenuTestBase
Base class for all administration menu web test cases.

Namespace

Drupal\admin_menu\Tests

Code

protected function assertElementByXPath($xpath, array $arguments = [], $message, $group = 'Other') {
  $elements = $this
    ->xpath($xpath, $arguments);
  return $this
    ->assertTrue(!empty($elements[0]), $message, $group);
}