function HtmlResponseAttachmentsTest::assertFeed
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php \Drupal\Tests\system\Functional\Render\HtmlResponseAttachmentsTest::assertFeed()
- 10 core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php \Drupal\Tests\system\Functional\Render\HtmlResponseAttachmentsTest::assertFeed()
- 11.x core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php \Drupal\Tests\system\Functional\Render\HtmlResponseAttachmentsTest::assertFeed()
Helper function to make assertions about the presence of an RSS feed.
2 calls to HtmlResponseAttachmentsTest::assertFeed()
- HtmlResponseAttachmentsTest::testAttachments in core/
modules/ system/ tests/ src/ Functional/ Render/ HtmlResponseAttachmentsTest.php - Test rendering of ['#attached'].
- HtmlResponseAttachmentsTest::testRenderCachedBlock in core/
modules/ system/ tests/ src/ Functional/ Render/ HtmlResponseAttachmentsTest.php - Test caching of ['#attached'].
File
-
core/
modules/ system/ tests/ src/ Functional/ Render/ HtmlResponseAttachmentsTest.php, line 110
Class
- HtmlResponseAttachmentsTest
- Functional tests for HtmlResponseAttachmentsProcessor.
Namespace
Drupal\Tests\system\Functional\RenderCode
protected function assertFeed() {
// Discover the DOM element for the feed link.
$test_meta = $this->xpath('//head/link[@href="test://url"]');
$this->assertCount(1, $test_meta, 'Link has URL.');
// Reconcile the other attributes.
$test_meta_attributes = [
'href' => 'test://url',
'rel' => 'alternate',
'type' => 'application/rss+xml',
'title' => 'Your RSS feed.',
];
$test_meta = reset($test_meta);
if (empty($test_meta)) {
$this->fail('Unable to find feed link.');
}
else {
foreach ($test_meta_attributes as $attribute => $value) {
$this->assertEquals($value, $test_meta->getAttribute($attribute));
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.