Yaffs site version 1.1
[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\simpletest\WebTestBase;
6 use Drupal\metatag\Tests\MetatagTagsTestBase;
7
8 /**
9  * Tests that each of the Metatag Favicons tags work correctly.
10  *
11  * @group metatag
12  */
13 class MetatagFaviconsTagsTest extends MetatagTagsTestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public $tags = [
19     'shortcut_icon',
20     //'mask_icon',
21     'icon_16x16',
22     'icon_32x32',
23     'icon_96x96',
24     'icon_192x192',
25     'apple_touch_icon',
26     'apple_touch_icon_72x72',
27     'apple_touch_icon_76x76',
28     'apple_touch_icon_114x114',
29     'apple_touch_icon_120x120',
30     'apple_touch_icon_144x144',
31     'apple_touch_icon_152x152',
32     'apple_touch_icon_180x180',
33     'apple_touch_icon_precomposed',
34     'apple_touch_icon_precomposed_72x72',
35     'apple_touch_icon_precomposed_76x76',
36     'apple_touch_icon_precomposed_114x114',
37     'apple_touch_icon_precomposed_120x120',
38     'apple_touch_icon_precomposed_144x144',
39     'apple_touch_icon_precomposed_152x152',
40     'apple_touch_icon_precomposed_180x180',
41   ];
42
43   /**
44    * {@inheritdoc}
45    */
46   public $test_tag = 'link';
47
48   /**
49    * {@inheritdoc}
50    */
51   public $test_name_attribute = 'rel';
52
53   /**
54    * {@inheritdoc}
55    */
56   public $test_value_attribute = 'href';
57
58   /**
59    * {@inheritdoc}
60    */
61   protected function setUp() {
62     parent::$modules[] = 'metatag_favicons';
63     parent::setUp();
64   }
65
66   /**
67    * Implements {meta_tag_name}_test_value_attribute() for
68    * 'shortcut icon'.
69    */
70   public function shortcut_icon_test_value_attribute() {
71     return 'href';
72   }
73
74   /**
75    * Implements {meta_tag_name}_test_output_xpath() for 'icon_16x16',
76    */
77   public function icon_16x16_test_output_xpath() {
78     return "//link[@rel='icon' and @sizes='16x16']";
79   }
80
81   /**
82    * Implements {meta_tag_name}_test_output_xpath() for 'icon_192x192',
83    */
84   public function icon_192x192_test_output_xpath() {
85     return "//link[@rel='icon' and @sizes='192x192']";
86   }
87
88   /**
89    * Implements {meta_tag_name}_test_output_xpath() for 'icon_32x32',
90    */
91   public function icon_32x32_test_output_xpath() {
92     return "//link[@rel='icon' and @sizes='32x32']";
93   }
94
95   /**
96    * Implements {meta_tag_name}_test_output_xpath() for 'icon_96x96',
97    */
98   public function icon_96x96_test_output_xpath() {
99     return "//link[@rel='icon' and @sizes='96x96']";
100   }
101
102   /**
103    * Implements {meta_tag_name}_test_output_xpath() for
104    * 'apple_touch_icon_precomposed',
105    */
106   public function apple_touch_icon_precomposed_test_output_xpath() {
107     return "//link[@rel='apple-touch-icon-precomposed' and not(@sizes)]";
108   }
109
110   /**
111    * Implements {meta_tag_name}_test_output_xpath() for
112    * 'apple_touch_icon_precomposed_114x114',
113    */
114   public function apple_touch_icon_precomposed_114x114_test_output_xpath() {
115     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='114x114']";
116   }
117
118   /**
119    * Implements {meta_tag_name}_test_output_xpath() for
120    * 'apple_touch_icon_precomposed_120x120',
121    */
122   public function apple_touch_icon_precomposed_120x120_test_output_xpath() {
123     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='120x120']";
124   }
125
126   /**
127    * Implements {meta_tag_name}_test_output_xpath() for
128    * 'apple_touch_icon_precomposed_144x144',
129    */
130   public function apple_touch_icon_precomposed_144x144_test_output_xpath() {
131     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='144x144']";
132   }
133
134   /**
135    * Implements {meta_tag_name}_test_output_xpath() for
136    * 'apple_touch_icon_precomposed_152x152',
137    */
138   public function apple_touch_icon_precomposed_152x152_test_output_xpath() {
139     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='152x152']";
140   }
141
142   /**
143    * Implements {meta_tag_name}_test_output_xpath() for
144    * 'apple_touch_icon_precomposed_180x180',
145    */
146   public function apple_touch_icon_precomposed_180x180_test_output_xpath() {
147     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='180x180']";
148   }
149
150   /**
151    * Implements {meta_tag_name}_test_output_xpath() for
152    * 'apple_touch_icon_precomposed_72x72',
153    */
154   public function apple_touch_icon_precomposed_72x72_test_output_xpath() {
155     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='72x72']";
156   }
157
158   /**
159    * Implements {meta_tag_name}_test_output_xpath() for
160    * 'apple_touch_icon_precomposed_76x76',
161    */
162   public function apple_touch_icon_precomposed_76x76_test_output_xpath() {
163     return "//link[@rel='apple-touch-icon-precomposed' and @sizes='76x76']";
164   }
165
166   /**
167    * Implements {meta_tag_name}_test_output_xpath() for 'apple_touch_icon',
168    */
169   public function apple_touch_icon_test_output_xpath() {
170     return "//link[@rel='apple-touch-icon' and not(@sizes)]";
171   }
172
173   /**
174    * Implements {meta_tag_name}_test_output_xpath() for
175    * 'apple_touch_icon_114x114',
176    */
177   public function apple_touch_icon_114x114_test_output_xpath() {
178     return "//link[@rel='apple-touch-icon' and @sizes='114x114']";
179   }
180
181   /**
182    * Implements {meta_tag_name}_test_output_xpath() for
183    * 'apple_touch_icon_120x120',
184    */
185   public function apple_touch_icon_120x120_test_output_xpath() {
186     return "//link[@rel='apple-touch-icon' and @sizes='120x120']";
187   }
188
189   /**
190    * Implements {meta_tag_name}_test_output_xpath() for
191    * 'apple_touch_icon_144x144',
192    */
193   public function apple_touch_icon_144x144_test_output_xpath() {
194     return "//link[@rel='apple-touch-icon' and @sizes='144x144']";
195   }
196
197   /**
198    * Implements {meta_tag_name}_test_output_xpath() for
199    * 'apple_touch_icon_152x152',
200    */
201   public function apple_touch_icon_152x152_test_output_xpath() {
202     return "//link[@rel='apple-touch-icon' and @sizes='152x152']";
203   }
204
205   /**
206    * Implements {meta_tag_name}_test_output_xpath() for
207    * 'apple_touch_icon_180x180',
208    */
209   public function apple_touch_icon_180x180_test_output_xpath() {
210     return "//link[@rel='apple-touch-icon' and @sizes='180x180']";
211   }
212
213   /**
214    * Implements {meta_tag_name}_test_output_xpath() for
215    * 'apple_touch_icon_72x72',
216    */
217   public function apple_touch_icon_72x72_test_output_xpath() {
218     return "//link[@rel='apple-touch-icon' and @sizes='72x72']";
219   }
220
221   /**
222    * Implements {meta_tag_name}_test_output_xpath() for
223    * 'apple_touch_icon_76x76',
224    */
225   public function apple_touch_icon_76x76_test_output_xpath() {
226     return "//link[@rel='apple-touch-icon' and @sizes='76x76']";
227   }
228
229   /**
230    * Implements {meta_tag_name}_test_output_xpath for 'mask-icon'.
231    */
232   public function mask_icon_test_tag_name() {
233     return 'mask-icon';
234   }
235
236   /**
237    * Implements {meta_tag_name}_test_tag_name for 'shortcut icon'.
238    */
239   public function shortcut_icon_test_tag_name() {
240     return 'shortcut icon';
241   }
242
243 }