Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / metatag / metatag_open_graph / src / Tests / MetatagOpenGraphTagsTest.php
1 <?php
2
3 namespace Drupal\metatag_open_graph\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 MetatagOpenGraphTagsTest extends MetatagTagsTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   private $tags = [
18     'article_author',
19     'article_expiration_time',
20     'article_modified_time',
21     'article_published_time',
22     'article_publisher',
23     'article_section',
24     'article_tag',
25     'book_author',
26     'book_isbn',
27     'book_releasedate',
28     'book_tag',
29     'og_country_name',
30     'og_description',
31     'og_determiner',
32     'og_email',
33     'og_fax_number',
34     'og_image',
35     'og_image_alt',
36     'og_image_height',
37     'og_image_secure_url',
38     'og_image_type',
39     'og_image_url',
40     'og_image_width',
41     'og_latitude',
42     'og_locale',
43     'og_locale_alternative',
44     'og_locality',
45     'og_longitude',
46     'og_phone_number',
47     'og_postal_code',
48     'og_region',
49     'og_see_also',
50     'og_site_name',
51     'og_street_address',
52     'og_title',
53     'og_type',
54     'og_updated_time',
55     'og_url',
56     'og_video',
57     'og_video_height',
58     'og_video_secure_url',
59     'og_video_type',
60     'og_video_width',
61   ];
62
63   /**
64    * {@inheritdoc}
65    */
66   private $testTag = 'meta';
67
68   /**
69    * {@inheritdoc}
70    */
71   private $testNameAttribute = 'property';
72
73   /**
74    * {@inheritdoc}
75    */
76   protected function setUp() {
77     parent::$modules[] = 'metatag_open_graph';
78     parent::setUp();
79   }
80
81   /**
82    * Each of these meta tags has a different tag name vs its internal name.
83    */
84   private function getTestTagName($tag_name) {
85     // Replace the first underline with a colon.
86     $tag_name = str_replace('og_', 'og:', $tag_name);
87     $tag_name = str_replace('article_', 'article:', $tag_name);
88     $tag_name = str_replace('book_', 'book:', $tag_name);
89
90     // Some tags have an additional underline that turns into a colon.
91     $tag_name = str_replace('og:image_', 'og:image:', $tag_name);
92     $tag_name = str_replace('og:video_', 'og:video:', $tag_name);
93
94     // Additional fixes.
95     if ($tag_name == 'og:locale_alternative') {
96       $tag_name = 'og:locale:alternate';
97     }
98
99     return $tag_name;
100   }
101
102 }