public function DefaultMetatagsTest::testMetaTag in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Page/DefaultMetatagsTest.php \Drupal\system\Tests\Page\DefaultMetatagsTest::testMetaTag()
Tests meta tags.
File
- core/
modules/ system/ src/ Tests/ Page/ DefaultMetatagsTest.php, line 22 - Contains \Drupal\system\Tests\Page\DefaultMetatagsTest.
Class
- DefaultMetatagsTest
- Tests default HTML metatags on a page.
Namespace
Drupal\system\Tests\PageCode
public function testMetaTag() {
$this
->drupalGet('');
// Ensures that the charset metatag is on the page.
$result = $this
->xpath('//meta[@charset="utf-8"]');
$this
->assertEqual(count($result), 1);
// Ensure that the charset one is the first metatag.
$result = $this
->xpath('//meta');
$this
->assertEqual((string) $result[0]
->attributes()->charset, 'utf-8');
// Ensure that the shortcut icon is on the page.
$result = $this
->xpath('//link[@rel = "shortcut icon"]');
$this
->assertEqual(count($result), 1, 'The shortcut icon is present.');
}