3 namespace Drupal\metatag\Tests;
6 * Tests that each of the Metatag base tags work correctly.
10 class MetatagTagsTest extends MetatagTagsTestBase {
40 * Each of these meta tags has a different tag name vs its internal name.
42 private function getTestTagName($tag_name) {
43 if ($tag_name == 'geo_placename') {
44 $tag_name = 'geo.placename';
46 elseif ($tag_name == 'geo_position') {
47 $tag_name = 'geo.position';
49 elseif ($tag_name == 'geo_region') {
50 $tag_name = 'geo.region';
52 elseif ($tag_name == 'content_language') {
53 $tag_name = 'content-language';
55 elseif ($tag_name == 'original_source') {
56 $tag_name = 'original-source';
58 elseif ($tag_name == 'set_cookie') {
59 $tag_name = 'set-cookie';
66 * Implements {tag_name}TestFieldXpath() for 'abstract'.
68 private function abstractTestFieldXpath() {
69 return "//textarea[@name='abstract']";
73 * Implements {tag_name}TestNameAttribute() for 'author'.
75 private function authorTestOutputXpath() {
76 return "//link[@rel='author']";
80 * Implements {tag_name}TestValueAttribute() for 'author'.
82 private function authorTestValueAttribute() {
87 * Implements {tag_name}TestNameAttribute() for 'canonical_url'.
89 private function canonicalUrlTestOutputXpath() {
90 return "//link[@rel='canonical']";
94 * Implements {tag_name}TestValueAttribute() for 'canonical_url'.
96 private function canonicalUrlTestValueAttribute() {
101 * Implements {tag_name}TestNameAttribute() for 'content_language'.
103 private function contentLanguageTestNameAttribute() {
108 * Implements {tag_name}TestNameAttribute() for 'set_cookie'.
110 private function setCookieTestNameAttribute() {
115 * Implements {tag_name}TestFieldXpath() for 'description'.
117 private function descriptionTestFieldXpath() {
118 return "//textarea[@name='description']";
122 * Implements {tag_name}TestOutputXpath() for 'image_src'.
124 private function imageSrcTestOutputXpath() {
125 return "//link[@rel='image_src']";
129 * Implements {tag_name}TestValueAttribute() for 'image_src'.
131 private function imageSrcTestValueAttribute() {
136 * Implements {tag_name}TestFieldXpath() for 'referrer'.
138 private function referrerTestFieldXpath() {
139 return "//select[@name='referrer']";
143 * Implements {tag_name}TestFieldXpath() for 'robots'.
145 private function robotsTestFieldXpath() {
146 return "//input[@name='robots[index]' and @type='checkbox']";
150 * Implements {tag_name}TestValue() for 'referrer'.
152 private function referrerTestValue() {
157 * Implements {tag_name}TestValue() for 'robots'.
159 private function robotsTestKey() {
160 return 'robots[index]';
164 * Implements {tag_name}TestValue() for 'robots'.
166 private function robotsTestValue() {
171 * Implements {tag_name}TestOutputXpath() for 'shortlink'.
173 private function shortlinkTestOutputXpath() {
174 return "//link[@rel='shortlink']";
178 * Implements {tag_name}TestValueAttribute() for 'shortlink'.
180 private function shortlinkTestValueAttribute() {