public function MetatagTagsTestBase::testTagsArePresent in Metatag 8
Tests that this module's tags are available.
File
- tests/
src/ Functional/ MetatagTagsTestBase.php, line 91
Class
- MetatagTagsTestBase
- Base class to test all of the meta tags that are in a specific module.
Namespace
Drupal\Tests\metatag\FunctionalCode
public function testTagsArePresent() {
// Load the global config.
$this
->drupalGet('admin/config/search/metatag/global');
$this
->assertSession()
->statusCodeEquals(200);
// Confirm the various meta tags are available.
foreach ($this->tags as $tag) {
// Look for a custom method named "{$tagname}TestFieldXpath", if found
// use that method to get the xpath definition for this meta tag,
// otherwise it defaults to just looking for a text input field.
$method = $this
->getMethodFromTagCallback($tag, 'test_field_xpath');
if (method_exists($this, $method)) {
$xpath = $this
->{$method}();
}
else {
$xpath = "//input[@name='{$tag}' and @type='text']";
}
$this
->xpath($xpath);
}
$this
->drupalLogout();
}