protected function HtmlResponseAttachmentsTest::assertHead in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Render/HtmlResponseAttachmentsTest.php \Drupal\system\Tests\Render\HtmlResponseAttachmentsTest::assertHead()
Helper function to make assertions about HTML head elements.
2 calls to HtmlResponseAttachmentsTest::assertHead()
- HtmlResponseAttachmentsTest::testAttachments in core/
modules/ system/ src/ Tests/ Render/ HtmlResponseAttachmentsTest.php - Test rendering of ['#attached'].
- HtmlResponseAttachmentsTest::testRenderCachedBlock in core/
modules/ system/ src/ Tests/ Render/ HtmlResponseAttachmentsTest.php - Test caching of ['#attached'].
File
- core/
modules/ system/ src/ Tests/ Render/ HtmlResponseAttachmentsTest.php, line 126 - Contains \Drupal\system\Tests\Render\HtmlResponseAttachmentsTest.
Class
- HtmlResponseAttachmentsTest
- Functional tests for HtmlResponseAttachmentsProcessor.
Namespace
Drupal\system\Tests\RenderCode
protected function assertHead() {
// Discover the DOM element for the meta link.
$test_meta = $this
->xpath('//head/meta[@test-attribute="testvalue"]');
$this
->assertEqual(1, count($test_meta), 'There\'s only one test attribute.');
// Grab the only DOM element.
$test_meta = reset($test_meta);
if (empty($test_meta)) {
$this
->fail('Unable to find the head meta.');
}
else {
$test_meta_attributes = $test_meta
->attributes();
$this
->assertEqual($test_meta_attributes['test-attribute'], 'testvalue');
}
}