summaryrefslogtreecommitdiffstats
path: root/core/modules/system/src/Tests/System/TokenReplaceWebTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/system/src/Tests/System/TokenReplaceWebTest.php')
-rw-r--r--core/modules/system/src/Tests/System/TokenReplaceWebTest.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/core/modules/system/src/Tests/System/TokenReplaceWebTest.php b/core/modules/system/src/Tests/System/TokenReplaceWebTest.php
new file mode 100644
index 0000000..7e9d60f
--- /dev/null
+++ b/core/modules/system/src/Tests/System/TokenReplaceWebTest.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\system\Tests\System\TokenReplaceWebTest.
+ */
+
+namespace Drupal\system\Tests\System;
+
+use Drupal\simpletest\WebTestBase;
+use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
+
+/**
+ * Tests the token system integration.
+ *
+ * @group system
+ */
+class TokenReplaceWebTest extends WebTestBase {
+
+ use AssertPageCacheContextsAndTagsTrait;
+
+ /**
+ * {@inheritdoc}
+ */
+ public static $modules = ['token_test', 'filter', 'node'];
+
+ /**
+ * Tests a token replacement on an actual website.
+ */
+ public function testTokens() {
+ $node = $this->drupalCreateNode();
+ $account = $this->drupalCreateUser();
+ $this->drupalLogin($account);
+
+ $this->drupalGet('token-test/' . $node->id());
+ $this->assertText("Tokens: {$node->id()} {$account->id()}");
+ $this->assertCacheTags(['node:1', 'rendered', 'user:2']);
+ $this->assertCacheContexts(['languages:language_interface', 'theme', 'user']);
+
+ $this->drupalGet('token-test-without-bubleable-metadata/' . $node->id());
+ $this->assertText("Tokens: {$node->id()} {$account->id()}");
+ $this->assertCacheTags(['node:1', 'rendered', 'user:2']);
+ $this->assertCacheContexts(['languages:language_interface', 'theme', 'user']);
+ }
+
+}