View source
<?php
namespace Drupal\Tests\metatag_mobile\Functional;
use Drupal\Tests\metatag\Functional\MetatagTagsTestBase;
class MetatagMobileTagsTest extends MetatagTagsTestBase {
protected static $modules = [
'metatag_mobile',
];
protected $tags = [
'alternate_handheld',
'android_app_link_alternative',
'apple_itunes_app',
'apple_mobile_web_app_capable',
'apple_mobile_web_app_status_bar_style',
'apple_mobile_web_app_title',
'application_name',
'cleartype',
'format_detection',
'ios_app_link_alternative',
'msapplication_allowDomainApiCalls',
'msapplication_allowDomainMetaTags',
'msapplication_badge',
'msapplication_config',
'msapplication_navbutton_color',
'msapplication_notification',
'msapplication_square150x150logo',
'msapplication_square310x310logo',
'msapplication_square70x70logo',
'msapplication_starturl',
'msapplication_task',
'msapplication_task_separator',
'msapplication_tilecolor',
'msapplication_tileimage',
'msapplication_tooltip',
'msapplication_wide310x150logo',
'msapplication_window',
'theme_color',
'viewport',
'web_manifest',
'x_ua_compatible',
];
protected function getTestTagName($tag_name) {
$tag_name = str_replace('_', '-', $tag_name);
$tag_name = str_replace('android_manifest', 'manifest', $tag_name);
$tag_name = str_replace('handheldfriendly', 'HandheldFriendly', $tag_name);
$tag_name = str_replace('mobileoptimized', 'MobileOptimized', $tag_name);
return $tag_name;
}
protected function alternateHandheldTestOutputXpath() {
return "//link[@rel='alternate' and @media='handheld']";
}
protected function alternateHandheldTestValueAttribute() {
return 'href';
}
protected function androidAppLinkAlternativeTestValue() {
return 'android-app:' . $this
->randomMachineName();
}
protected function androidAppLinkAlternativeTestOutputXpath() {
return "//link[@rel='alternate' and starts-with(@href, 'android-app:')]";
}
protected function androidAppLinkAlternativeTestValueAttribute() {
return 'href';
}
protected function cleartypeTestNameAttribute() {
return 'http-equiv';
}
protected function iosAppLinkAlternativeTestValue() {
return 'ios-app:' . $this
->randomMachineName();
}
protected function iosAppLinkAlternativeTestOutputXpath() {
return "//link[@rel='alternate' and starts-with(@href, 'ios-app:')]";
}
protected function iosAppLinkAlternativeTestValueAttribute() {
return 'href';
}
protected function mobileoptimizedTestOutputXpath() {
return "//meta[@name='MobileOptimized']";
}
protected function msapplicationSquare150x150logoTestValue() {
return $this
->randomImageUrl();
}
protected function msapplicationSquare310x310logoTestValue() {
return $this
->randomImageUrl();
}
protected function msapplicationSquare70x70logoTestValue() {
return $this
->randomImageUrl();
}
protected function msapplicationTileimageTestValue() {
return $this
->randomImageUrl();
}
protected function msapplicationWide310x150logoTestValue() {
return $this
->randomImageUrl();
}
protected function webManifestTestOutputXpath() {
return "//link[@rel='manifest']";
}
protected function webManifestTestValueAttribute() {
return 'href';
}
protected function xUaCompatibleTestNameAttribute() {
return 'http-equiv';
}
}