// Repeat for the cache.
$this->
drupalGet('/render_attached_test/head'
);
$this->
assertSession()->
responseHeaderEquals('X-Drupal-Cache', 'HIT'
);
// Test ['#attached']['html_head_link'] when outputted as HTTP header.
$this->
drupalGet('/render_attached_test/html_header_link'
);
$expected_link_headers =
[ '</foo?bar=<baz>&baz=false>; rel="alternate"',
'</foo/bar>; hreflang="nl"; rel="alternate"',
'</foo/bar>; hreflang="de"; rel="alternate"',
];
$this->
assertEquals($expected_link_headers,
$this->
getSession()->
getResponseHeaders()['Link'
]);
// Check that duplicate alternate URLs with different hreflang attributes
// are allowed.
$this->
assertSession()->
elementsCount('xpath', '//head/link[@rel="alternate"][@href="/foo/bar"]', 2
);
} /**
* Tests caching of ['#attached'].
*/
public function testRenderCachedBlock() { // Make sure our test block is visible.