3 namespace Drupal\metatag\Tests;
5 use Drupal\simpletest\WebTestBase;
6 use Drupal\metatag\Tests\MetatagTagsTestBase;
9 * Tests that each of the Metatag base tags work correctly.
13 class MetatagTagsTest extends MetatagTagsTestBase {
41 * Each of these meta tags has a different tag name vs its internal name.
43 public function getTestTagName($tag_name) {
44 if ($tag_name == 'geo_placename') {
45 $tag_name = 'geo.placename';
47 elseif ($tag_name == 'geo_position') {
48 $tag_name = 'geo.position';
50 elseif ($tag_name == 'geo_region') {
51 $tag_name = 'geo.region';
53 elseif ($tag_name == 'content_language') {
54 $tag_name = 'content-language';
56 elseif ($tag_name == 'original_source') {
57 $tag_name = 'original-source';
63 * Implements {meta_tag_name}_test_field_xpath() for 'abstract'.
65 public function abstract_test_field_xpath() {
66 return "//textarea[@name='abstract']";
70 * Implements {meta_tag_name}_test_name_attribute() for 'author'.
72 public function author_test_output_xpath() {
73 return "//link[@rel='author']";
77 * Implements {meta_tag_name}_test_value_attribute() for 'author'.
79 public function author_test_value_attribute() {
84 * Implements {meta_tag_name}_test_name_attribute() for 'canonical_url'.
86 public function canonical_url_test_output_xpath() {
87 return "//link[@rel='canonical']";
91 * Implements {meta_tag_name}_test_value_attribute() for 'canonical_url'.
93 public function canonical_url_test_value_attribute() {
98 * Implements {meta_tag_name}_test_name_attribute() for 'content_language'.
100 public function content_language_test_name_attribute() {
105 * Implements {meta_tag_name}_test_field_xpath() for 'description'.
107 public function description_test_field_xpath() {
108 return "//textarea[@name='description']";
112 * Implements {meta_tag_name}_test_output_xpath() for 'image_src'.
114 public function image_src_test_output_xpath() {
115 return "//link[@rel='image_src']";
119 * Implements {meta_tag_name}_test_value_attribute() for 'image_src'.
121 public function image_src_test_value_attribute() {
126 * Implements {meta_tag_name}_test_field_xpath() for 'referrer'.
128 public function referrer_test_field_xpath() {
129 return "//select[@name='referrer']";
133 * Implements {meta_tag_name}_test_field_xpath() for 'robots'.
135 public function robots_test_field_xpath() {
136 return "//input[@name='robots[index]' and @type='checkbox']";
140 * Implements {meta_tag_name}_test_value() for 'referrer'.
142 public function referrer_test_value() {
147 * Implements {meta_tag_name}_test_value() for 'robots'.
149 public function robots_test_key() {
150 return 'robots[index]';
154 * Implements {meta_tag_name}_test_value() for 'robots'.
156 public function robots_test_value() {
161 * Implements {meta_tag_name}_test_output_xpath() for 'shortlink'.
163 public function shortlink_test_output_xpath() {
164 return "//link[@rel='shortlink']";
168 * Implements {meta_tag_name}_test_value_attribute() for 'shortlink'.
170 public function shortlink_test_value_attribute() {