function TokenTestTrait::assertNoTokens in Token 8
4 calls to TokenTestTrait::assertNoTokens()
- FieldTest::testEntityFieldTokens in tests/
src/ Kernel/ FieldTest.php - Tests [entity:field_name] tokens.
- FieldTest::testEntityReferenceTokens in tests/
src/ Kernel/ FieldTest.php - FieldTest::testEntityReferenceTokensCardinality in tests/
src/ Kernel/ FieldTest.php - Tests support for cardinality > 1 for entity reference tokens.
- TokenMenuTest::testMenuLinkParentsToken in tests/
src/ Functional/ TokenMenuTest.php - Tests menu link parents token.
File
- tests/
src/ Functional/ TokenTestTrait.php, line 52
Class
- TokenTestTrait
- Helper test trait with some added functions for testing.
Namespace
Drupal\Tests\token\FunctionalCode
function assertNoTokens($type, array $data, array $tokens, array $options = []) {
$input = $this
->mapTokenNames($type, $tokens);
$bubbleable_metadata = new BubbleableMetadata();
$replacements = \Drupal::token()
->generate($type, $input, $data, $options, $bubbleable_metadata);
foreach ($tokens as $name) {
$token = $input[$name];
$this
->assertTrue(!isset($replacements[$token]), t("Token value for @token was not generated.", [
'@type' => $type,
'@token' => $token,
]));
}
}