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().
110 * For 'apple_touch_icon_precomposed_114x114'.
112 private function appleTouchIconPrecomposed114x114TestOutputXpath() {
113 return "//link[@rel='apple-touch-icon-precomposed' and @sizes='114x114']";
117 * Implements {tag_name}TestOutputXpath().
119 * For 'apple_touch_icon_precomposed_120x120'.
121 private function appleTouchIconPrecomposed120x120TestOutputXpath() {
122 return "//link[@rel='apple-touch-icon-precomposed' and @sizes='120x120']";
126 * Implements {tag_name}TestOutputXpath().
128 * For 'apple_touch_icon_precomposed_144x144'.
130 private function appleTouchIconPrecomposed144x144TestOutputXpath() {
131 return "//link[@rel='apple-touch-icon-precomposed' and @sizes='144x144']";
135 * Implements {tag_name}TestOutputXpath().
137 * For 'apple_touch_icon_precomposed_152x152'.
139 private function appleTouchIconPrecomposed152x152TestOutputXpath() {
140 return "//link[@rel='apple-touch-icon-precomposed' and @sizes='152x152']";
144 * Implements {tag_name}TestOutputXpath().
146 * For 'apple_touch_icon_precomposed_180x180'.
148 private function appleTouchIconPrecomposed180x180TestOutputXpath() {
149 return "//link[@rel='apple-touch-icon-precomposed' and @sizes='180x180']";
153 * Implements {tag_name}TestOutputXpath().
155 * For 'apple_touch_icon_precomposed_72x72'.
157 private function appleTouchIconPrecomposed72x72TestOutputXpath() {
158 return "//link[@rel='apple-touch-icon-precomposed' and @sizes='72x72']";
162 * Implements {tag_name}TestOutputXpath().
164 * For 'apple_touch_icon_precomposed_76x76'.
166 private function appleTouchIconPrecomposed76x76TestOutputXpath() {
167 return "//link[@rel='apple-touch-icon-precomposed' and @sizes='76x76']";
171 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon'.
173 private function appleTouchIconTestOutputXpath() {
174 return "//link[@rel='apple-touch-icon' and not(@sizes)]";
178 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_114x114'.
180 private function appleTouchIcon114x114TestOutputXpath() {
181 return "//link[@rel='apple-touch-icon' and @sizes='114x114']";
185 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_120x120'.
187 private function appleTouchIcon120x120TestOutputXpath() {
188 return "//link[@rel='apple-touch-icon' and @sizes='120x120']";
192 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_144x144'.
194 private function appleTouchIcon144x144TestOutputXpath() {
195 return "//link[@rel='apple-touch-icon' and @sizes='144x144']";
199 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_152x152'.
201 private function appleTouchIcon152x152TestOutputXpath() {
202 return "//link[@rel='apple-touch-icon' and @sizes='152x152']";
206 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_180x180'.
208 private function appleTouchIcon180x180TestOutputXpath() {
209 return "//link[@rel='apple-touch-icon' and @sizes='180x180']";
213 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_72x72'.
215 private function appleTouchIcon72x72TestOutputXpath() {
216 return "//link[@rel='apple-touch-icon' and @sizes='72x72']";
220 * Implements {tag_name}TestOutputXpath() for 'apple_touch_icon_76x76'.
222 private function appleTouchIcon76x76TestOutputXpath() {
223 return "//link[@rel='apple-touch-icon' and @sizes='76x76']";
227 * Implements {tag_name}TestOutputXpath for 'mask-icon'.
229 private function maskIconTestTagName() {
234 * Implements {tag_name}TestTagName for 'shortcut icon'.
236 private function shortcutIconTestTagName() {
237 return 'shortcut icon';