metatag_favicons.tags.test 6.6 KB

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