core/modules/system/src/Tests/Common/RenderWebTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/modules/system/src/Tests/Common/RenderWebTest.php b/core/modules/system/src/Tests/Common/RenderWebTest.php index c3dd78b..5cfe3ab 100644 --- a/core/modules/system/src/Tests/Common/RenderWebTest.php +++ b/core/modules/system/src/Tests/Common/RenderWebTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Common; +use Drupal\Component\Serialization\Json; use Drupal\Core\EventSubscriber\MainContentViewSubscriber; use Drupal\Core\Url; use Drupal\simpletest\WebTestBase; @@ -30,8 +31,16 @@ class RenderWebTest extends WebTestBase { */ function testWrapperFormatCacheContext() { $this->drupalGet(''); + $this->assertIdentical(0, strpos($this->getRawContent(), "\nassertIdentical('text/html; charset=UTF-8', $this->drupalGetHeader('Content-Type')); + $this->assertTitle('Log in | Drupal'); $this->assertCacheContext('url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT); + $this->drupalGet('', ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'json']]); + $this->assertIdentical('application/json', $this->drupalGetHeader('Content-Type')); + $json = Json::decode($this->getRawContent()); + $this->assertEqual(['content', 'title'], array_keys($json)); + $this->assertIdentical('Log in', $json['title']); $this->assertCacheContext('url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT); }