Yaffs site version 1.1
[yaffs-website] / web / modules / contrib / metatag / metatag_favicons / src / Tests / MetatagFaviconsTagsTest.php
index e7cdcc13cff9ba585b673ef0ca281ca164ec2c52..c44ff78401a72ff9fdd4eac54a640c8e13dfc95b 100644 (file)
@@ -16,17 +16,44 @@ class MetatagFaviconsTagsTest extends MetatagTagsTestBase {
    * {@inheritdoc}
    */
   public $tags = [
+    'shortcut_icon',
+    //'mask_icon',
+    'icon_16x16',
+    'icon_32x32',
+    'icon_96x96',
+    'icon_192x192',
+    'apple_touch_icon',
+    'apple_touch_icon_72x72',
+    'apple_touch_icon_76x76',
+    'apple_touch_icon_114x114',
+    'apple_touch_icon_120x120',
+    'apple_touch_icon_144x144',
+    'apple_touch_icon_152x152',
+    'apple_touch_icon_180x180',
+    'apple_touch_icon_precomposed',
+    'apple_touch_icon_precomposed_72x72',
+    'apple_touch_icon_precomposed_76x76',
+    'apple_touch_icon_precomposed_114x114',
+    'apple_touch_icon_precomposed_120x120',
+    'apple_touch_icon_precomposed_144x144',
+    'apple_touch_icon_precomposed_152x152',
+    'apple_touch_icon_precomposed_180x180',
   ];
 
   /**
-   * The tag to look for when testing the output.
+   * {@inheritdoc}
+   */
+  public $test_tag = 'link';
+
+  /**
+   * {@inheritdoc}
    */
-  public $test_tag = 'meta';
+  public $test_name_attribute = 'rel';
 
   /**
-   * The attribute to look for to indicate which tag.
+   * {@inheritdoc}
    */
-  public $test_name_attribute = 'property';
+  public $test_value_attribute = 'href';
 
   /**
    * {@inheritdoc}
@@ -37,23 +64,180 @@ class MetatagFaviconsTagsTest extends MetatagTagsTestBase {
   }
 
   /**
-   * Each of these meta tags has a different tag name vs its internal name.
+   * Implements {meta_tag_name}_test_value_attribute() for
+   * 'shortcut icon'.
+   */
+  public function shortcut_icon_test_value_attribute() {
+    return 'href';
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for 'icon_16x16',
+   */
+  public function icon_16x16_test_output_xpath() {
+    return "//link[@rel='icon' and @sizes='16x16']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for 'icon_192x192',
+   */
+  public function icon_192x192_test_output_xpath() {
+    return "//link[@rel='icon' and @sizes='192x192']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for 'icon_32x32',
+   */
+  public function icon_32x32_test_output_xpath() {
+    return "//link[@rel='icon' and @sizes='32x32']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for 'icon_96x96',
+   */
+  public function icon_96x96_test_output_xpath() {
+    return "//link[@rel='icon' and @sizes='96x96']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_precomposed',
    */
-  public function getTestTagName($tag_name) {
-    // Replace the first underline with a colon.
-    $tag_name = str_replace('og_', 'og:', $tag_name);
-    $tag_name = str_replace('article_', 'article:', $tag_name);
+  public function apple_touch_icon_precomposed_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon-precomposed' and not(@sizes)]";
+  }
 
-    // Some tags have an additional underline that turns into a colon.
-    $tag_name = str_replace('og:image_', 'og:image:', $tag_name);
-    $tag_name = str_replace('og:video_', 'og:video:', $tag_name);
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_precomposed_114x114',
+   */
+  public function apple_touch_icon_precomposed_114x114_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon-precomposed' and @sizes='114x114']";
+  }
 
-    // Additional fixes.
-    if ($tag_name == 'og:locale_alternative') {
-      $tag_name = 'og:locale:alternate';
-    }
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_precomposed_120x120',
+   */
+  public function apple_touch_icon_precomposed_120x120_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon-precomposed' and @sizes='120x120']";
+  }
 
-    return $tag_name;
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_precomposed_144x144',
+   */
+  public function apple_touch_icon_precomposed_144x144_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon-precomposed' and @sizes='144x144']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_precomposed_152x152',
+   */
+  public function apple_touch_icon_precomposed_152x152_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon-precomposed' and @sizes='152x152']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_precomposed_180x180',
+   */
+  public function apple_touch_icon_precomposed_180x180_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon-precomposed' and @sizes='180x180']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_precomposed_72x72',
+   */
+  public function apple_touch_icon_precomposed_72x72_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon-precomposed' and @sizes='72x72']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_precomposed_76x76',
+   */
+  public function apple_touch_icon_precomposed_76x76_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon-precomposed' and @sizes='76x76']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for 'apple_touch_icon',
+   */
+  public function apple_touch_icon_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon' and not(@sizes)]";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_114x114',
+   */
+  public function apple_touch_icon_114x114_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon' and @sizes='114x114']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_120x120',
+   */
+  public function apple_touch_icon_120x120_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon' and @sizes='120x120']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_144x144',
+   */
+  public function apple_touch_icon_144x144_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon' and @sizes='144x144']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_152x152',
+   */
+  public function apple_touch_icon_152x152_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon' and @sizes='152x152']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_180x180',
+   */
+  public function apple_touch_icon_180x180_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon' and @sizes='180x180']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_72x72',
+   */
+  public function apple_touch_icon_72x72_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon' and @sizes='72x72']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath() for
+   * 'apple_touch_icon_76x76',
+   */
+  public function apple_touch_icon_76x76_test_output_xpath() {
+    return "//link[@rel='apple-touch-icon' and @sizes='76x76']";
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_output_xpath for 'mask-icon'.
+   */
+  public function mask_icon_test_tag_name() {
+    return 'mask-icon';
+  }
+
+  /**
+   * Implements {meta_tag_name}_test_tag_name for 'shortcut icon'.
+   */
+  public function shortcut_icon_test_tag_name() {
+    return 'shortcut icon';
   }
 
 }