3 namespace Drupal\metatag_open_graph\Tests;
5 use Drupal\simpletest\WebTestBase;
6 use Drupal\metatag\Tests\MetatagTagsTestBase;
9 * Tests that each of the Metatag Open Graph tags work correctly.
13 class MetatagOpenGraphTagsTest extends MetatagTagsTestBase {
20 'article_expiration_time',
21 'article_modified_time',
22 'article_published_time',
33 'og_image_secure_url',
39 'og_locale_alternative',
54 'og_video_secure_url',
60 * The tag to look for when testing the output.
62 public $test_tag = 'meta';
65 * The attribute to look for to indicate which tag.
67 public $test_name_attribute = 'property';
72 protected function setUp() {
73 parent::$modules[] = 'metatag_open_graph';
78 * Each of these meta tags has a different tag name vs its internal name.
80 public function getTestTagName($tag_name) {
81 // Replace the first underline with a colon.
82 $tag_name = str_replace('og_', 'og:', $tag_name);
83 $tag_name = str_replace('article_', 'article:', $tag_name);
85 // Some tags have an additional underline that turns into a colon.
86 $tag_name = str_replace('og:image_', 'og:image:', $tag_name);
87 $tag_name = str_replace('og:video_', 'og:video:', $tag_name);
90 if ($tag_name == 'og:locale_alternative') {
91 $tag_name = 'og:locale:alternate';