trait AssertBreadcrumbTrait (View source)

deprecated in drupal:8.?.? and is removed from drupal:9.0.0. Use \Drupal\Tests\system\Functional\Menu\AssertBreadcrumbTrait instead.

Provides test assertions for verifying breadcrumbs.

Traits

Provides test assertions for verifying the active menu trail.

Methods

assertMenuActiveTrail(array $tree, bool $last_active)

Assert that active trail exists in a menu tree output.

assertBreadcrumb(Url|string $goto, array $trail, string $page_title = NULL, array $tree = [], $last_active = TRUE)

Assert that a given path shows certain breadcrumb links.

assertBreadcrumbParts(array $trail)

Assert that a trail exists in the internal browser.

getBreadcrumbParts()

Returns the breadcrumb contents of the current page in the internal browser.

Details

protected assertMenuActiveTrail(array $tree, bool $last_active)

Assert that active trail exists in a menu tree output.

Parameters

array $tree

An associative array whose keys are link paths and whose values are link titles (not sanitized) of an expected active trail in a menu tree output on the page.

bool $last_active

Whether the last link in $tree is expected to be active (TRUE) or just to be in the active trail (FALSE).

protected assertBreadcrumb(Url|string $goto, array $trail, string $page_title = NULL, array $tree = [], $last_active = TRUE)

Assert that a given path shows certain breadcrumb links.

Parameters

Url|string $goto

(optional) A path or URL to pass to Drupal\simpletest\WebTestBase::drupalGet().

array $trail

An associative array whose keys are expected breadcrumb link paths and whose values are expected breadcrumb link texts (not sanitized).

string $page_title

(optional) A page title to additionally assert via Drupal\simpletest\WebTestBase::assertTitle(). Without site name suffix.

array $tree

(optional) An associative array whose keys are link paths and whose values are link titles (not sanitized) of an expected active trail in a menu tree output on the page.

$last_active

(optional) Whether the last link in $tree is expected to be active (TRUE) or just to be in the active trail (FALSE).

protected assertBreadcrumbParts(array $trail)

Assert that a trail exists in the internal browser.

Parameters

array $trail

An associative array whose keys are expected breadcrumb link paths and whose values are expected breadcrumb link texts (not sanitized).

protected getBreadcrumbParts()

Returns the breadcrumb contents of the current page in the internal browser.