dc8eea5add2d5d05aa0c850cb84782bd7f0fcd89
[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\metatag\Tests\MetatagTagsTestBase;
6
7 /**
8  * Tests that each of the Metatag Google Plus tags work correctly.
9  *
10  * @group metatag
11  */
12 class MetatagGooglePlusTagsTest extends MetatagTagsTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   private $tags = [
18     'google_plus_author',
19     'google_plus_description',
20     'google_plus_image',
21     'google_plus_name',
22     'google_plus_publisher',
23   ];
24
25   /**
26    * {@inheritdoc}
27    */
28   private $testNameAttribute = 'itemprop';
29
30   /**
31    * {@inheritdoc}
32    */
33   protected function setUp() {
34     parent::$modules[] = 'metatag_google_plus';
35     parent::setUp();
36   }
37
38   /**
39    * Each of these meta tags has a different tag name vs its internal name.
40    */
41   private function getTestTagName($tag_name) {
42     $tag_name = str_replace('google_plus_', 'itemprop:', $tag_name);
43     if ($tag_name == 'itemprop:publisher') {
44       $tag_name = 'publisher';
45     }
46     return $tag_name;
47   }
48
49   /**
50    * Implements {tag_name}TestNameAttribute() for 'author'.
51    */
52   private function googlePlusAuthorTestOutputXpath() {
53     return "//link[@rel='author']";
54   }
55
56   /**
57    * Implements {tag_name}TestValueAttribute() for 'author'.
58    */
59   private function googlePlusAuthorTestValueAttribute() {
60     return 'href';
61   }
62
63   /**
64    * Implements {tag_name}TestNameAttribute() for 'publisher'.
65    */
66   private function googlePlusPublisherTestOutputXpath() {
67     return "//link[@rel='publisher']";
68   }
69
70   /**
71    * Implements {tag_name}TestValueAttribute() for 'publisher'.
72    */
73   private function googlePlusPublisherTestValueAttribute() {
74     return 'href';
75   }
76
77 }