function NodeViewTest::testLinkHeader
Same name in other branches
- 9 core/modules/node/tests/src/Functional/NodeViewTest.php \Drupal\Tests\node\Functional\NodeViewTest::testLinkHeader()
- 10 core/modules/node/tests/src/Functional/NodeViewTest.php \Drupal\Tests\node\Functional\NodeViewTest::testLinkHeader()
- 11.x core/modules/node/tests/src/Functional/NodeViewTest.php \Drupal\Tests\node\Functional\NodeViewTest::testLinkHeader()
Tests the Link header.
File
-
core/
modules/ node/ tests/ src/ Functional/ NodeViewTest.php, line 76
Class
- NodeViewTest
- Tests the node/{node} page.
Namespace
Drupal\Tests\node\FunctionalCode
public function testLinkHeader() {
$node = $this->drupalCreateNode();
$expected = [
'<' . Html::escape($node->toUrl('canonical')
->setAbsolute()
->toString()) . '>; rel="canonical"',
'<' . Html::escape($node->toUrl('canonical')
->setAbsolute()
->toString(), [
'alias' => TRUE,
]) . '>; rel="shortlink"',
'<' . Html::escape($node->toUrl('revision')
->setAbsolute()
->toString()) . '>; rel="revision"',
];
$this->drupalGet($node->toUrl());
$links = $this->getSession()
->getResponseHeaders()['Link'];
$this->assertEqual($links, $expected);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.