function DefaultMetatagsTest::testMetaTag
Same name in other branches
- 8.9.x core/modules/system/tests/src/Functional/Page/DefaultMetatagsTest.php \Drupal\Tests\system\Functional\Page\DefaultMetatagsTest::testMetaTag()
- 10 core/modules/system/tests/src/Functional/Page/DefaultMetatagsTest.php \Drupal\Tests\system\Functional\Page\DefaultMetatagsTest::testMetaTag()
- 11.x core/modules/system/tests/src/Functional/Page/DefaultMetatagsTest.php \Drupal\Tests\system\Functional\Page\DefaultMetatagsTest::testMetaTag()
Tests meta tags.
File
-
core/
modules/ system/ tests/ src/ Functional/ Page/ DefaultMetatagsTest.php, line 22
Class
- DefaultMetatagsTest
- Tests default HTML metatags on a page.
Namespace
Drupal\Tests\system\Functional\PageCode
public function testMetaTag() {
$this->drupalGet('');
// Ensures that the charset metatag is on the page.
$this->assertSession()
->elementsCount('xpath', '//meta[@charset="utf-8"]', 1);
// Ensure that the charset one is the first metatag.
$result = $this->xpath('//meta');
$this->assertEquals('utf-8', (string) $result[0]->getAttribute('charset'));
// Ensure that the icon is on the page.
$this->assertSession()
->elementsCount('xpath', '//link[@rel = "icon"]', 1);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.