summaryrefslogtreecommitdiffstats
path: root/core/modules/taxonomy/src/Tests/TokenReplaceTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/taxonomy/src/Tests/TokenReplaceTest.php')
-rw-r--r--core/modules/taxonomy/src/Tests/TokenReplaceTest.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/core/modules/taxonomy/src/Tests/TokenReplaceTest.php b/core/modules/taxonomy/src/Tests/TokenReplaceTest.php
index 1051201..ff7c8ef 100644
--- a/core/modules/taxonomy/src/Tests/TokenReplaceTest.php
+++ b/core/modules/taxonomy/src/Tests/TokenReplaceTest.php
@@ -10,6 +10,7 @@ namespace Drupal\taxonomy\Tests;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\Core\Render\BubbleableMetadata;
/**
* Generates text using placeholders for dummy content to check taxonomy token
@@ -91,10 +92,26 @@ class TokenReplaceTest extends TaxonomyTestBase {
$tests['[term:node-count]'] = 0;
$tests['[term:parent:name]'] = '[term:parent:name]';
$tests['[term:vocabulary:name]'] = SafeMarkup::checkPlain($this->vocabulary->label());
+ $tests['[term:vocabulary]'] = SafeMarkup::checkPlain($this->vocabulary->label());
+
+ $base_bubbleable_metadata = BubbleableMetadata::createFromObject($term1);
+
+ $metadata_tests = array();
+ $metadata_tests['[term:tid]'] = $base_bubbleable_metadata;
+ $metadata_tests['[term:name]'] = $base_bubbleable_metadata;
+ $metadata_tests['[term:description]'] = $base_bubbleable_metadata;
+ $metadata_tests['[term:url]'] = $base_bubbleable_metadata;
+ $metadata_tests['[term:node-count]'] = $base_bubbleable_metadata;
+ $metadata_tests['[term:parent:name]'] = $base_bubbleable_metadata;
+ $bubbleable_metadata = clone $base_bubbleable_metadata;
+ $metadata_tests['[term:vocabulary:name]'] = $bubbleable_metadata->addCacheTags($this->vocabulary->getCacheTags());
+ $metadata_tests['[term:vocabulary]'] = $bubbleable_metadata->addCacheTags($this->vocabulary->getCacheTags());
foreach ($tests as $input => $expected) {
- $output = $token_service->replace($input, array('term' => $term1), array('langcode' => $language_interface->getId()));
+ $bubbleable_metadata = new BubbleableMetadata();
+ $output = $token_service->replace($input, array('term' => $term1), array('langcode' => $language_interface->getId()), $bubbleable_metadata);
$this->assertEqual($output, $expected, format_string('Sanitized taxonomy term token %token replaced.', array('%token' => $input)));
+ $this->assertEqual($bubbleable_metadata, $metadata_tests[$input]);
}
// Generate and test sanitized tokens for term2.