You are here

protected function TokenTreeTestTrait::assertTokenInTree in Token 8

Check to see if the specified token is present in the token browser.

Parameters

$token: The token name with the surrounding square brackets [].

string $parent: (optional) The parent CSS identifier of this token.

string $message: (optional) A message to display with the assertion.

5 calls to TokenTreeTestTrait::assertTokenInTree()
HelpPageTest::testHelpPageTree in tests/src/Functional/Tree/HelpPageTest.php
Tests the token browser on the token help page.
TreeTest::testAllTokens in tests/src/Functional/Tree/TreeTest.php
Test various tokens that are possible on the site.
TreeTest::testGlobalTokens in tests/src/Functional/Tree/TreeTest.php
Test various tokens that are possible on the site.
TreeTest::testNodeTokens in tests/src/Functional/Tree/TreeTest.php
Tests if the token browser displays the node tokens.
TreeTest::testUserTokens in tests/src/Functional/Tree/TreeTest.php
Tests if the token browser displays the user tokens.

File

tests/src/Functional/Tree/TokenTreeTestTrait.php, line 72

Class

TokenTreeTestTrait
Helper trait to assert tokens in token tree browser.

Namespace

Drupal\Tests\token\Functional\Tree

Code

protected function assertTokenInTree($token, $parent = '', $message = '') {
  $xpath = $this
    ->getXpathForTokenInTree($token, $parent);
  if (!$message) {
    $message = "Token {$token} found.";
  }
  $this
    ->assertCount(1, $this
    ->xpath($xpath), $message);
}