Updated to Drupal 8.5. Core Media not yet in use.
[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() for
109    * 'apple_touch_icon_precomposed_114x114'.
110    */
111   private function appleTouchIconPrecomposed114x114TestOutputXpath() {
112     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='114x114']";
113   }
114
115   /**
116    * Implements {tag_name}TestOutputXpath() for
117    * 'apple_touch_icon_precomposed_120x120'.
118    */
119   private function appleTouchIconPrecomposed120x120TestOutputXpath() {
120     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='120x120']";
121   }
122
123   /**
124    * Implements {tag_name}TestOutputXpath() for
125    * 'apple_touch_icon_precomposed_144x144'.
126    */
127   private function appleTouchIconPrecomposed144x144TestOutputXpath() {
128     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='144x144']";
129   }
130
131   /**
132    * Implements {tag_name}TestOutputXpath() for
133    * 'apple_touch_icon_precomposed_152x152'.
134    */
135   private function appleTouchIconPrecomposed152x152TestOutputXpath() {
136     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='152x152']";
137   }
138
139   /**
140    * Implements {tag_name}TestOutputXpath() for
141    * 'apple_touch_icon_precomposed_180x180'.
142    */
143   private function appleTouchIconPrecomposed180x180TestOutputXpath() {
144     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='180x180']";
145   }
146
147   /**
148    * Implements {tag_name}TestOutputXpath() for
149    * 'apple_touch_icon_precomposed_72x72'.
150    */
151   private function appleTouchIconPrecomposed72x72TestOutputXpath() {
152     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='72x72']";
153   }
154
155   /**
156    * Implements {tag_name}TestOutputXpath() for
157    * 'apple_touch_icon_precomposed_76x76'.
158    */
159   private function appleTouchIconPrecomposed76x76TestOutputXpath() {
160     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='76x76']";
161   }
162
163   /**
164    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon'.
165    */
166   private function appleTouchIconTestOutputXpath() {
167     return "//link[@rel='apple-touch-icon' and not(@sizes)]";
168   }
169
170   /**
171    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_114x114'.
172    */
173   private function appleTouchIcon114x114TestOutputXpath() {
174     return "//link[@rel='apple-touch-icon' and @sizes='114x114']";
175   }
176
177   /**
178    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_120x120'.
179    */
180   private function appleTouchIcon120x120TestOutputXpath() {
181     return "//link[@rel='apple-touch-icon' and @sizes='120x120']";
182   }
183
184   /**
185    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_144x144'.
186    */
187   private function appleTouchIcon144x144TestOutputXpath() {
188     return "//link[@rel='apple-touch-icon' and @sizes='144x144']";
189   }
190
191   /**
192    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_152x152'.
193    */
194   private function appleTouchIcon152x152TestOutputXpath() {
195     return "//link[@rel='apple-touch-icon' and @sizes='152x152']";
196   }
197
198   /**
199    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_180x180'.
200    */
201   private function appleTouchIcon180x180TestOutputXpath() {
202     return "//link[@rel='apple-touch-icon' and @sizes='180x180']";
203   }
204
205   /**
206    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_72x72'.
207    */
208   private function appleTouchIcon72x72TestOutputXpath() {
209     return "//link[@rel='apple-touch-icon' and @sizes='72x72']";
210   }
211
212   /**
213    * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_76x76'.
214    */
215   private function appleTouchIcon76x76TestOutputXpath() {
216     return "//link[@rel='apple-touch-icon' and @sizes='76x76']";
217   }
218
219   /**
220    * Implements {tag_name}TestOutputXpath for 'mask-icon'.
221    */
222   private function maskIconTestTagName() {
223     return 'mask-icon';
224   }
225
226   /**
227    * Implements {tag_name}TestTagName for 'shortcut icon'.
228    */
229   private function shortcutIconTestTagName() {
230     return 'shortcut icon';
231   }
232
233 }