DefaultMetatagsTest.php
Same filename in other branches
Namespace
Drupal\Tests\system\Functional\PageFile
-
core/
modules/ system/ tests/ src/ Functional/ Page/ DefaultMetatagsTest.php
View source
<?php
namespace Drupal\Tests\system\Functional\Page;
use Drupal\Tests\BrowserTestBase;
/**
* Tests default HTML metatags on a page.
*
* @group Page
*/
class DefaultMetatagsTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests meta tags.
*/
public function testMetaTag() {
$this->drupalGet('');
// Ensures that the charset metatag is on the page.
$result = $this->xpath('//meta[@charset="utf-8"]');
$this->assertCount(1, $result);
// Ensure that the charset one is the first metatag.
$result = $this->xpath('//meta');
$this->assertEqual((string) $result[0]->getAttribute('charset'), 'utf-8');
// Ensure that the shortcut icon is on the page.
$result = $this->xpath('//link[@rel = "shortcut icon"]');
$this->assertCount(1, $result, 'The shortcut icon is present.');
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
DefaultMetatagsTest | Tests default HTML metatags on a page. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.