3b302b7dc8530c687b30dd0fcbd6e31b333fc0c9
[yaffs-website] / web / modules / contrib / metatag / metatag_open_graph_products / src / Tests / MetatagOpenGraphProductsTagsTest.php
1 <?php
2
3 namespace Drupal\metatag_open_graph_products\Tests;
4
5 use Drupal\metatag\Tests\MetatagTagsTestBase;
6
7 /**
8  * Tests that each of the Metatag Open Graph tags work correctly.
9  *
10  * @group metatag
11  */
12 class MetatagOpenGraphProductsTagsTest extends MetatagTagsTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   private $tags = [];
18
19   /**
20    * {@inheritdoc}
21    */
22   private $testTag = 'meta';
23
24   /**
25    * {@inheritdoc}
26    */
27   private $testNameAttribute = 'property';
28
29   /**
30    * {@inheritdoc}
31    */
32   protected function setUp() {
33     parent::$modules[] = 'metatag_open_graph_products';
34     parent::setUp();
35   }
36
37   /**
38    * Each of these meta tags has a different tag name vs its internal name.
39    */
40   private function getTestTagName($tag_name) {
41     // Replace the first underline with a colon.
42     $tag_name = str_replace('og_', 'og:', $tag_name);
43     $tag_name = str_replace('article_', 'article:', $tag_name);
44
45     // Some tags have an additional underline that turns into a colon.
46     $tag_name = str_replace('og:image_', 'og:image:', $tag_name);
47     $tag_name = str_replace('og:video_', 'og:video:', $tag_name);
48
49     // Additional fixes.
50     if ($tag_name == 'og:locale_alternative') {
51       $tag_name = 'og:locale:alternate';
52     }
53
54     return $tag_name;
55   }
56
57 }