dda2dbb8f572915265542692bf7dc25f144b1e85
[yaffs-website] / web / modules / contrib / metatag / metatag_google_plus / src / Tests / MetatagGooglePlusTagsTest.php
1 <?php
2
3 namespace Drupal\metatag_google_plus\Tests;
4
5 use Drupal\simpletest\WebTestBase;
6 use Drupal\metatag\Tests\MetatagTagsTestBase;
7
8 /**
9  * Tests that each of the Metatag Google Plus tags work correctly.
10  *
11  * @group metatag
12  */
13 class MetatagGooglePlusTagsTest extends MetatagTagsTestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public $tags = [
19     'google_plus_author',
20     'google_plus_description',
21     'google_plus_image',
22     'google_plus_name',
23     'google_plus_publisher',
24   ];
25
26   /**
27    * The attribute to look for to indicate which tag.
28    */
29   public $test_name_attribute = 'itemprop';
30
31   /**
32    * {@inheritdoc}
33    */
34   protected function setUp() {
35     parent::$modules[] = 'metatag_google_plus';
36     parent::setUp();
37   }
38
39   /**
40    * Each of these meta tags has a different tag name vs its internal name.
41    */
42   public function getTestTagName($tag_name) {
43     $tag_name = str_replace('google_plus_', 'itemprop:', $tag_name);
44     if ($tag_name == 'itemprop:publisher') {
45       $tag_name = 'publisher';
46     }
47     return $tag_name;
48   }
49
50   /**
51    * Implements {meta_tag_name}_test_name_attribute() for 'author'.
52    */
53   public function google_plus_author_test_output_xpath() {
54     return "//link[@rel='author']";
55   }
56
57   /**
58    * Implements {meta_tag_name}_test_value_attribute() for 'author'.
59    */
60   public function google_plus_author_test_value_attribute() {
61     return 'href';
62   }
63
64   /**
65    * Implements {meta_tag_name}_test_name_attribute() for 'publisher'.
66    */
67   public function google_plus_publisher_test_output_xpath() {
68     return "//link[@rel='publisher']";
69   }
70
71   /**
72    * Implements {meta_tag_name}_test_value_attribute() for 'publisher'.
73    */
74   public function google_plus_publisher_test_value_attribute() {
75     return 'href';
76   }
77
78 }