public function UserMatcherTest::testTermMatcherWidthMetadataTokens in Linkit 8.5
Tests user matcher with tokens in the matcher metadata.
File
- tests/
src/ Kernel/ Matchers/ UserMatcherTest.php, line 120
Class
- UserMatcherTest
- Tests user matcher.
Namespace
Drupal\Tests\linkit\Kernel\MatchersCode
public function testTermMatcherWidthMetadataTokens() {
/** @var \Drupal\linkit\MatcherInterface $plugin */
$plugin = $this->manager
->createInstance('entity:user', [
'settings' => [
'metadata' => '[user:uid] [term:field_with_no_value]',
],
]);
$suggestionCollection = $plugin
->execute('Lorem');
/** @var \Drupal\linkit\Suggestion\EntitySuggestion[] $suggestions */
$suggestions = $suggestionCollection
->getSuggestions();
foreach ($suggestions as $suggestion) {
$this
->assertStringNotContainsString('[user:uid]', $suggestion
->getDescription(), 'Raw token "[user:nid]" is not present in the description');
$this
->assertStringNotContainsString('[user:field_with_no_value]', $suggestion
->getDescription(), 'Raw token "[user:field_with_no_value]" is not present in the description');
}
}