Commit e54aa5eb authored by alexpott's avatar alexpott
Browse files

Issue #2530908 by olli: Caching problem in PageTitleTest

parent 0623c095
...@@ -143,19 +143,19 @@ public function testRoutingTitle() { ...@@ -143,19 +143,19 @@ public function testRoutingTitle() {
// controller does not escape them. // controller does not escape them.
$this->drupalGet('test-page-cached-controller'); $this->drupalGet('test-page-cached-controller');
$this->assertTitle('Cached title | Drupal'); $this->assertTitle('Cached title | Drupal');
$this->assertText(SafeMarkup::checkPlain('<span>Cached title</span>')); $this->assertRaw(SafeMarkup::checkPlain('<span>Cached title</span>') . '</h1>');
$this->drupalGet('test-page-cached-controller'); $this->drupalGet('test-page-cached-controller');
$this->assertTitle('Cached title | Drupal'); $this->assertTitle('Cached title | Drupal');
$this->assertText(SafeMarkup::checkPlain('<span>Cached title</span>')); $this->assertRaw(SafeMarkup::checkPlain('<span>Cached title</span>') . '</h1>');
// Ensure that titles are cacheable and are escaped normally if the // Ensure that titles are cacheable and are escaped normally if the
// controller escapes them use SafeMarkup::checkPlain(). // controller escapes them use SafeMarkup::checkPlain().
$this->drupalGet('test-page-cached-controller-safe'); $this->drupalGet('test-page-cached-controller-safe');
$this->assertTitle('Cached title | Drupal'); $this->assertTitle('<span>Cached title</span> | Drupal');
$this->assertText(SafeMarkup::checkPlain('<span>Cached title</span>')); $this->assertRaw(SafeMarkup::checkPlain('<span>Cached title</span>') . '</h1>');
$this->drupalGet('test-page-cached-controller-safe'); $this->drupalGet('test-page-cached-controller-safe');
$this->assertTitle('Cached title | Drupal'); $this->assertTitle('<span>Cached title</span> | Drupal');
$this->assertText(SafeMarkup::checkPlain('<span>Cached title</span>')); $this->assertRaw(SafeMarkup::checkPlain('<span>Cached title</span>') . '</h1>');
} }
} }
...@@ -66,7 +66,7 @@ public function controllerWithCache($mark_safe = FALSE) { ...@@ -66,7 +66,7 @@ public function controllerWithCache($mark_safe = FALSE) {
if ($mark_safe) { if ($mark_safe) {
$build['#title'] = SafeMarkup::checkPlain($build['#title']); $build['#title'] = SafeMarkup::checkPlain($build['#title']);
} }
$build['#cache']['keys'] = ['test_controller', 'with_title']; $build['#cache']['keys'] = ['test_controller', 'with_title', $mark_safe];
return $build; return $build;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment