Mercurial > hg > isophonics-drupal-site
comparison core/modules/system/src/Tests/System/TokenReplaceWebTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\system\Tests\System; | |
4 | |
5 use Drupal\Core\EventSubscriber\MainContentViewSubscriber; | |
6 use Drupal\simpletest\WebTestBase; | |
7 use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait; | |
8 | |
9 /** | |
10 * Tests the token system integration. | |
11 * | |
12 * @group system | |
13 */ | |
14 class TokenReplaceWebTest extends WebTestBase { | |
15 | |
16 use AssertPageCacheContextsAndTagsTrait; | |
17 | |
18 /** | |
19 * {@inheritdoc} | |
20 */ | |
21 public static $modules = ['token_test', 'filter', 'node']; | |
22 | |
23 /** | |
24 * Tests a token replacement on an actual website. | |
25 */ | |
26 public function testTokens() { | |
27 $node = $this->drupalCreateNode(); | |
28 $account = $this->drupalCreateUser(); | |
29 $this->drupalLogin($account); | |
30 | |
31 $this->drupalGet('token-test/' . $node->id()); | |
32 $this->assertText("Tokens: {$node->id()} {$account->id()}"); | |
33 $this->assertCacheTags(['node:1', 'rendered', 'user:2']); | |
34 $this->assertCacheContexts(['languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'user']); | |
35 | |
36 $this->drupalGet('token-test-without-bubleable-metadata/' . $node->id()); | |
37 $this->assertText("Tokens: {$node->id()} {$account->id()}"); | |
38 $this->assertCacheTags(['node:1', 'rendered', 'user:2']); | |
39 $this->assertCacheContexts(['languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'user']); | |
40 } | |
41 | |
42 } |