Commit e54aa5eb authored by alexpott's avatar alexpott

Issue #2530908 by olli: Caching problem in PageTitleTest

parent 0623c095
......@@ -143,19 +143,19 @@ public function testRoutingTitle() {
// controller does not escape them.
$this->drupalGet('test-page-cached-controller');
$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->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
// controller escapes them use SafeMarkup::checkPlain().
$this->drupalGet('test-page-cached-controller-safe');
$this->assertTitle('Cached title | Drupal');
$this->assertText(SafeMarkup::checkPlain('<span>Cached title</span>'));
$this->assertTitle('<span>Cached title</span> | Drupal');
$this->assertRaw(SafeMarkup::checkPlain('<span>Cached title</span>') . '</h1>');
$this->drupalGet('test-page-cached-controller-safe');
$this->assertTitle('Cached title | Drupal');
$this->assertText(SafeMarkup::checkPlain('<span>Cached title</span>'));
$this->assertTitle('<span>Cached title</span> | Drupal');
$this->assertRaw(SafeMarkup::checkPlain('<span>Cached title</span>') . '</h1>');
}
}
......@@ -66,7 +66,7 @@ public function controllerWithCache($mark_safe = FALSE) {
if ($mark_safe) {
$build['#title'] = SafeMarkup::checkPlain($build['#title']);
}
$build['#cache']['keys'] = ['test_controller', 'with_title'];
$build['#cache']['keys'] = ['test_controller', 'with_title', $mark_safe];
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