Version 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   ];
20
21   /**
22    * The tag to look for when testing the output.
23    */
24   public $test_tag = 'meta';
25
26   /**
27    * The attribute to look for to indicate which tag.
28    */
29   public $test_name_attribute = 'property';
30
31   /**
32    * {@inheritdoc}
33    */
34   protected function setUp() {
35     parent::$modules[] = 'metatag_favicons';
36     parent::setUp();
37   }
38
39   /**
40    * Each of these meta tags has a different tag name vs its internal name.
41    */
42   public function getTestTagName($tag_name) {
43     // Replace the first underline with a colon.
44     $tag_name = str_replace('og_', 'og:', $tag_name);
45     $tag_name = str_replace('article_', 'article:', $tag_name);
46
47     // Some tags have an additional underline that turns into a colon.
48     $tag_name = str_replace('og:image_', 'og:image:', $tag_name);
49     $tag_name = str_replace('og:video_', 'og:video:', $tag_name);
50
51     // Additional fixes.
52     if ($tag_name == 'og:locale_alternative') {
53       $tag_name = 'og:locale:alternate';
54     }
55
56     return $tag_name;
57   }
58
59 }