View source
<?php
namespace Drupal\Tests\metatag_twitter_cards\Functional;
use Drupal\Tests\metatag\Functional\MetatagTagsTestBase;
class MetatagTwitterCardsTagsTest extends MetatagTagsTestBase {
protected static $modules = [
'metatag_twitter_cards',
];
protected $tags = [
'twitter_cards_app_id_googleplay',
'twitter_cards_app_id_ipad',
'twitter_cards_app_id_iphone',
'twitter_cards_app_name_googleplay',
'twitter_cards_app_name_ipad',
'twitter_cards_app_name_iphone',
'twitter_cards_app_store_country',
'twitter_cards_app_url_googleplay',
'twitter_cards_app_url_ipad',
'twitter_cards_app_url_iphone',
'twitter_cards_creator',
'twitter_cards_creator_id',
'twitter_cards_data1',
'twitter_cards_data2',
'twitter_cards_description',
'twitter_cards_donottrack',
'twitter_cards_image_alt',
'twitter_cards_image_height',
'twitter_cards_image_width',
'twitter_cards_label1',
'twitter_cards_label2',
'twitter_cards_page_url',
'twitter_cards_player_height',
'twitter_cards_player_stream',
'twitter_cards_player_stream_content_type',
'twitter_cards_player_width',
'twitter_cards_site',
'twitter_cards_site_id',
'twitter_cards_title',
'twitter_cards_type',
];
protected function getTestTagName($tag_name) {
$tag_name = str_replace('twitter_cards', 'twitter', $tag_name);
$tag_name = str_replace('_', ':', $tag_name);
if ($tag_name == 'twitter:app:store:country') {
$tag_name = 'twitter:app:country';
}
elseif ($tag_name == 'twitter:page:url') {
$tag_name = 'twitter:url';
}
elseif ($tag_name == 'twitter:player:stream:content:type') {
$tag_name = 'twitter:player:stream:content_type';
}
elseif ($tag_name == 'twitter:type') {
$tag_name = 'twitter:card';
}
elseif ($tag_name == 'twitter:donottrack') {
$tag_name = 'twitter:dnt';
}
return $tag_name;
}
protected function twitterCardsTypeTestFieldXpath() {
return "//select[@name='twitter_cards_type']";
}
protected function twitterCardsTypeTestValue() {
return 'summary_large_image';
}
}