Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / metatag / metatag_favicons / src / Tests / MetatagFaviconsTagsTest.php
1 <?php
2
3 namespace Drupal\metatag_favicons\Tests;
4
5 use Drupal\metatag\Tests\MetatagTagsTestBase;
6
7 /**
8  * Tests that each of the Metatag Favicons tags work correctly.
9  *
10  * @group metatag
11  */
12 class MetatagFaviconsTagsTest extends MetatagTagsTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   private $tags = [
18     'shortcut_icon',
19     // 'mask_icon'.
20     'icon_16x16',
21     'icon_32x32',
22     'icon_96x96',
23     'icon_192x192',
24     'apple_touch_icon',
25     'apple_touch_icon_72x72',
26     'apple_touch_icon_76x76',
27     'apple_touch_icon_114x114',
28     'apple_touch_icon_120x120',
29     'apple_touch_icon_144x144',
30     'apple_touch_icon_152x152',
31     'apple_touch_icon_180x180',
32     'apple_touch_icon_precomposed',
33     'apple_touch_icon_precomposed_72x72',
34     'apple_touch_icon_precomposed_76x76',
35     'apple_touch_icon_precomposed_114x114',
36     'apple_touch_icon_precomposed_120x120',
37     'apple_touch_icon_precomposed_144x144',
38     'apple_touch_icon_precomposed_152x152',
39     'apple_touch_icon_precomposed_180x180',
40   ];
41
42   /**
43    * {@inheritdoc}
44    */
45   private $testTag = 'link';
46
47   /**
48    * {@inheritdoc}
49    */
50   private $testNameAttribute = 'rel';
51
52   /**
53    * {@inheritdoc}
54    */
55   private $testValueAttribute = 'href';
56
57   /**
58    * {@inheritdoc}
59    */
60   protected function setUp() {
61     parent::$modules[] = 'metatag_favicons';
62     parent::setUp();
63   }
64
65   /**
66    * Implements {tag_name}TestValueAttribute() for 'shortcut icon'.
67    */
68   private function shortcutIconTestValueAttribute() {
69     return 'href';
70   }
71
72   /**
73    * Implements {tag_name}TestOutputXpath() for 'icon_16x16'.
74    */
75   private function icon16x16TestOutputXpath() {
76     return "//link[@rel='icon' and @sizes='16x16']";
77   }
78
79   /**
80    * Implements {tag_name}TestOutputXpath() for 'icon_192x192'.
81    */
82   private function icon192x192TestOutputXpath() {
83     return "//link[@rel='icon' and @sizes='192x192']";
84   }
85
86   /**
87    * Implements {tag_name}TestOutputXpath() for 'icon_32x32'.
88    */
89   private function icon32x32TestOutputXpath() {
90     return "//link[@rel='icon' and @sizes='32x32']";
91   }
92
93   /**
94    * Implements {tag_name}TestOutputXpath() for 'icon_96x96'.
95    */
96   private function icon96x96TestOutputXpath() {
97     return "//link[@rel='icon' and @sizes='96x96']";
98   }
99
100   /**
101    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_precomposed'.
102    */
103   private function appleTouchIconPrecomposedTestOutputXpath() {
104     return "//link[@rel='apple-touch-icon-precomposed' and not(@sizes)]";
105   }
106
107   /**
108    * Implements {tag_name}TestOutputXpath().
109    *
110    * For 'apple_touch_icon_precomposed_114x114'.
111    */
112   private function appleTouchIconPrecomposed114x114TestOutputXpath() {
113     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='114x114']";
114   }
115
116   /**
117    * Implements {tag_name}TestOutputXpath().
118    *
119    * For 'apple_touch_icon_precomposed_120x120'.
120    */
121   private function appleTouchIconPrecomposed120x120TestOutputXpath() {
122     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='120x120']";
123   }
124
125   /**
126    * Implements {tag_name}TestOutputXpath().
127    *
128    * For 'apple_touch_icon_precomposed_144x144'.
129    */
130   private function appleTouchIconPrecomposed144x144TestOutputXpath() {
131     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='144x144']";
132   }
133
134   /**
135    * Implements {tag_name}TestOutputXpath().
136    *
137    * For 'apple_touch_icon_precomposed_152x152'.
138    */
139   private function appleTouchIconPrecomposed152x152TestOutputXpath() {
140     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='152x152']";
141   }
142
143   /**
144    * Implements {tag_name}TestOutputXpath().
145    *
146    * For 'apple_touch_icon_precomposed_180x180'.
147    */
148   private function appleTouchIconPrecomposed180x180TestOutputXpath() {
149     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='180x180']";
150   }
151
152   /**
153    * Implements {tag_name}TestOutputXpath().
154    *
155    * For 'apple_touch_icon_precomposed_72x72'.
156    */
157   private function appleTouchIconPrecomposed72x72TestOutputXpath() {
158     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='72x72']";
159   }
160
161   /**
162    * Implements {tag_name}TestOutputXpath().
163    *
164    * For 'apple_touch_icon_precomposed_76x76'.
165    */
166   private function appleTouchIconPrecomposed76x76TestOutputXpath() {
167     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='76x76']";
168   }
169
170   /**
171    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon'.
172    */
173   private function appleTouchIconTestOutputXpath() {
174     return "//link[@rel='apple-touch-icon' and not(@sizes)]";
175   }
176
177   /**
178    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_114x114'.
179    */
180   private function appleTouchIcon114x114TestOutputXpath() {
181     return "//link[@rel='apple-touch-icon' and @sizes='114x114']";
182   }
183
184   /**
185    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_120x120'.
186    */
187   private function appleTouchIcon120x120TestOutputXpath() {
188     return "//link[@rel='apple-touch-icon' and @sizes='120x120']";
189   }
190
191   /**
192    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_144x144'.
193    */
194   private function appleTouchIcon144x144TestOutputXpath() {
195     return "//link[@rel='apple-touch-icon' and @sizes='144x144']";
196   }
197
198   /**
199    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_152x152'.
200    */
201   private function appleTouchIcon152x152TestOutputXpath() {
202     return "//link[@rel='apple-touch-icon' and @sizes='152x152']";
203   }
204
205   /**
206    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_180x180'.
207    */
208   private function appleTouchIcon180x180TestOutputXpath() {
209     return "//link[@rel='apple-touch-icon' and @sizes='180x180']";
210   }
211
212   /**
213    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_72x72'.
214    */
215   private function appleTouchIcon72x72TestOutputXpath() {
216     return "//link[@rel='apple-touch-icon' and @sizes='72x72']";
217   }
218
219   /**
220    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_76x76'.
221    */
222   private function appleTouchIcon76x76TestOutputXpath() {
223     return "//link[@rel='apple-touch-icon' and @sizes='76x76']";
224   }
225
226   /**
227    * Implements {tag_name}TestOutputXpath for 'mask-icon'.
228    */
229   private function maskIconTestTagName() {
230     return 'mask-icon';
231   }
232
233   /**
234    * Implements {tag_name}TestTagName for 'shortcut icon'.
235    */
236   private function shortcutIconTestTagName() {
237     return 'shortcut icon';
238   }
239
240 }