3 namespace Drupal\metatag_favicons\Tests;
5 use Drupal\metatag\Tests\MetatagTagsTestBase;
8 * Tests that each of the Metatag Favicons tags work correctly.
12 class MetatagFaviconsTagsTest extends MetatagTagsTestBase {
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',
45 private $testTag = 'link';
50 private $testNameAttribute = 'rel';
55 private $testValueAttribute = 'href';
60 protected function setUp() {
61 parent::$modules[] = 'metatag_favicons';
66 * Implements {tag_name}TestValueAttribute() for 'shortcut icon'.
68 private function shortcutIconTestValueAttribute() {
73 * Implements {tag_name}TestOutputXpath() for 'icon_16x16'.
75 private function icon16x16TestOutputXpath() {
76 return "//link[@rel='icon' and @sizes='16x16']";
80 * Implements {tag_name}TestOutputXpath() for 'icon_192x192'.
82 private function icon192x192TestOutputXpath() {
83 return "//link[@rel='icon' and @sizes='192x192']";
87 * Implements {tag_name}TestOutputXpath() for 'icon_32x32'.
89 private function icon32x32TestOutputXpath() {
90 return "//link[@rel='icon' and @sizes='32x32']";
94 * Implements {tag_name}TestOutputXpath() for 'icon_96x96'.
96 private function icon96x96TestOutputXpath() {
97 return "//link[@rel='icon' and @sizes='96x96']";
101 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_precomposed'.
103 private function appleTouchIconPrecomposedTestOutputXpath() {
104 return "//link[@rel='apple-touch-icon-precomposed' and not(@sizes)]";
108 * Implements {tag_name}TestOutputXpath() for
109 * 'apple_touch_icon_precomposed_114x114'.
111 private function appleTouchIconPrecomposed114x114TestOutputXpath() {
112 return "//link[@rel='apple-touch-icon-precomposed' and @sizes='114x114']";
116 * Implements {tag_name}TestOutputXpath() for
117 * 'apple_touch_icon_precomposed_120x120'.
119 private function appleTouchIconPrecomposed120x120TestOutputXpath() {
120 return "//link[@rel='apple-touch-icon-precomposed' and @sizes='120x120']";
124 * Implements {tag_name}TestOutputXpath() for
125 * 'apple_touch_icon_precomposed_144x144'.
127 private function appleTouchIconPrecomposed144x144TestOutputXpath() {
128 return "//link[@rel='apple-touch-icon-precomposed' and @sizes='144x144']";
132 * Implements {tag_name}TestOutputXpath() for
133 * 'apple_touch_icon_precomposed_152x152'.
135 private function appleTouchIconPrecomposed152x152TestOutputXpath() {
136 return "//link[@rel='apple-touch-icon-precomposed' and @sizes='152x152']";
140 * Implements {tag_name}TestOutputXpath() for
141 * 'apple_touch_icon_precomposed_180x180'.
143 private function appleTouchIconPrecomposed180x180TestOutputXpath() {
144 return "//link[@rel='apple-touch-icon-precomposed' and @sizes='180x180']";
148 * Implements {tag_name}TestOutputXpath() for
149 * 'apple_touch_icon_precomposed_72x72'.
151 private function appleTouchIconPrecomposed72x72TestOutputXpath() {
152 return "//link[@rel='apple-touch-icon-precomposed' and @sizes='72x72']";
156 * Implements {tag_name}TestOutputXpath() for
157 * 'apple_touch_icon_precomposed_76x76'.
159 private function appleTouchIconPrecomposed76x76TestOutputXpath() {
160 return "//link[@rel='apple-touch-icon-precomposed' and @sizes='76x76']";
164 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon'.
166 private function appleTouchIconTestOutputXpath() {
167 return "//link[@rel='apple-touch-icon' and not(@sizes)]";
171 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_114x114'.
173 private function appleTouchIcon114x114TestOutputXpath() {
174 return "//link[@rel='apple-touch-icon' and @sizes='114x114']";
178 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_120x120'.
180 private function appleTouchIcon120x120TestOutputXpath() {
181 return "//link[@rel='apple-touch-icon' and @sizes='120x120']";
185 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_144x144'.
187 private function appleTouchIcon144x144TestOutputXpath() {
188 return "//link[@rel='apple-touch-icon' and @sizes='144x144']";
192 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_152x152'.
194 private function appleTouchIcon152x152TestOutputXpath() {
195 return "//link[@rel='apple-touch-icon' and @sizes='152x152']";
199 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_180x180'.
201 private function appleTouchIcon180x180TestOutputXpath() {
202 return "//link[@rel='apple-touch-icon' and @sizes='180x180']";
206 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_72x72'.
208 private function appleTouchIcon72x72TestOutputXpath() {
209 return "//link[@rel='apple-touch-icon' and @sizes='72x72']";
213 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_76x76'.
215 private function appleTouchIcon76x76TestOutputXpath() {
216 return "//link[@rel='apple-touch-icon' and @sizes='76x76']";
220 * Implements {tag_name}TestOutputXpath for 'mask-icon'.
222 private function maskIconTestTagName() {
227 * Implements {tag_name}TestTagName for 'shortcut icon'.
229 private function shortcutIconTestTagName() {
230 return 'shortcut icon';