3 namespace Drupal\metatag_twitter_cards\Tests;
5 use Drupal\simpletest\WebTestBase;
6 use Drupal\metatag\Tests\MetatagTagsTestBase;
9 * Tests that each of the Metatag Twitter Cards tags work correctly.
13 class MetatagTwitterCardsTagsTest extends MetatagTagsTestBase {
19 'twitter_cards_app_id_googleplay',
20 'twitter_cards_app_id_ipad',
21 'twitter_cards_app_id_iphone',
22 'twitter_cards_app_name_googleplay',
23 'twitter_cards_app_name_ipad',
24 'twitter_cards_app_name_iphone',
25 'twitter_cards_app_store_country',
26 'twitter_cards_app_url_googleplay',
27 'twitter_cards_app_url_ipad',
28 'twitter_cards_app_url_iphone',
29 'twitter_cards_creator',
30 'twitter_cards_creator_id',
31 'twitter_cards_data1',
32 'twitter_cards_data2',
33 'twitter_cards_description',
34 'twitter_cards_gallery_image0',
35 'twitter_cards_gallery_image1',
36 'twitter_cards_gallery_image2',
37 'twitter_cards_gallery_image3',
38 'twitter_cards_image',
39 'twitter_cards_image_alt',
40 'twitter_cards_image_height',
41 'twitter_cards_image_width',
42 'twitter_cards_label1',
43 'twitter_cards_label2',
44 'twitter_cards_page_url',
45 'twitter_cards_player',
46 'twitter_cards_player_height',
47 'twitter_cards_player_stream',
48 'twitter_cards_player_stream_content_type',
49 'twitter_cards_player_width',
51 'twitter_cards_site_id',
52 'twitter_cards_title',
59 protected function setUp() {
60 parent::$modules[] = 'metatag_twitter_cards';
65 * Twitter meta tags (almost) all have colons instead of underlines, and they
66 * don't have "cards" in their name.
68 public function getTestTagName($tag_name) {
69 $tag_name = str_replace('twitter_cards', 'twitter', $tag_name);
70 $tag_name = str_replace('_', ':', $tag_name);
72 if ($tag_name == 'twitter:app:store:country') {
73 $tag_name = 'twitter:app:country';
75 elseif ($tag_name == 'twitter:page:url') {
76 $tag_name = 'twitter:url';
78 elseif ($tag_name == 'twitter:player:stream:content:type') {
79 $tag_name = 'twitter:player:stream:content_type';
81 elseif ($tag_name == 'twitter:type') {
82 $tag_name = 'twitter:card';
84 elseif ($tag_name == '') {
92 * Implements {meta_tag_name}_test_field_xpath() for 'twitter_cards_type'.
94 public function twitter_cards_type_test_field_xpath() {
95 return "//select[@name='twitter_cards_type']";
99 * Implements {meta_tag_name}_test_value() for 'twitter_cards_type'.
101 public function twitter_cards_type_test_value() {
102 return 'summary_large_image';