View source
<?php
namespace Drupal\Tests\metatag\Functional;
class MetatagTagsTest extends MetatagTagsTestBase {
protected $tags = [
'abstract',
'cache_control',
'canonical_url',
'content_language',
'description',
'expires',
'generator',
'geo_placename',
'geo_position',
'geo_region',
'google',
'icbm',
'image_src',
'keywords',
'news_keywords',
'next',
'original_source',
'pragma',
'prev',
'rating',
'referrer',
'refresh',
'revisit_after',
'rights',
'robots',
'set_cookie',
'shortlink',
'standout',
];
protected function getTestTagName($tag_name) {
if ($tag_name == 'geo_placename') {
$tag_name = 'geo.placename';
}
elseif ($tag_name == 'geo_position') {
$tag_name = 'geo.position';
}
elseif ($tag_name == 'geo_region') {
$tag_name = 'geo.region';
}
elseif ($tag_name == 'content_language') {
$tag_name = 'content-language';
}
elseif ($tag_name == 'original_source') {
$tag_name = 'original-source';
}
elseif ($tag_name == 'set_cookie') {
$tag_name = 'set-cookie';
}
elseif ($tag_name == 'cache_control') {
$tag_name = 'cache-control';
}
elseif ($tag_name == 'revisit_after') {
$tag_name = 'revisit-after';
}
return $tag_name;
}
protected function abstractTestFieldXpath() {
return "//textarea[@name='abstract']";
}
protected function authorTestOutputXpath() {
return "//link[@rel='author']";
}
protected function authorTestValueAttribute() {
return 'href';
}
protected function canonicalUrlTestOutputXpath() {
return "//link[@rel='canonical']";
}
protected function canonicalUrlTestValueAttribute() {
return 'href';
}
protected function contentLanguageTestNameAttribute() {
return 'http-equiv';
}
protected function setCookieTestNameAttribute() {
return 'http-equiv';
}
protected function descriptionTestFieldXpath() {
return "//textarea[@name='description']";
}
protected function imageSrcTestOutputXpath() {
return "//link[@rel='image_src']";
}
protected function imageSrcTestValueAttribute() {
return 'href';
}
protected function nextTestOutputXpath() {
return "//link[@rel='next']";
}
protected function nextTestValueAttribute() {
return 'href';
}
protected function prevTestOutputXpath() {
return "//link[@rel='prev']";
}
protected function prevTestValueAttribute() {
return 'href';
}
protected function referrerTestFieldXpath() {
return "//select[@name='referrer']";
}
protected function referrerTestValue() {
return 'origin';
}
protected function refreshTestNameAttribute() {
return 'http-equiv';
}
protected function robotsTestFieldXpath() {
return "//input[@name='robots[index]' and @type='checkbox']";
}
protected function robotsTestKey() {
return 'robots[index]';
}
protected function robotsTestValue() {
return 'index';
}
protected function shortlinkTestOutputXpath() {
return "//link[@rel='shortlink']";
}
protected function shortlinkTestValueAttribute() {
return 'href';
}
}