metatag_app_links.tags.test 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * Tests that each of the Metatag App Links tags work correctly.
  4. */
  5. class MetatagAppLinksTagsTest extends MetatagTagsTestBase {
  6. /**
  7. * {@inheritdoc}
  8. */
  9. public static function getInfo() {
  10. return array(
  11. 'name' => 'Metatag tags: App Links',
  12. 'description' => 'Test the App Links meta tags.',
  13. 'group' => 'Metatag',
  14. );
  15. }
  16. /**
  17. * {@inheritdoc}
  18. */
  19. public $tags = array(
  20. 'al:android:app_name',
  21. 'al:android:class',
  22. 'al:android:package',
  23. 'al:android:url',
  24. 'al:ios:app_name',
  25. 'al:ios:app_store_id',
  26. 'al:ios:url',
  27. 'al:ipad:app_name',
  28. 'al:ipad:app_store_id',
  29. 'al:ipad:url',
  30. 'al:iphone:app_name',
  31. 'al:iphone:app_store_id',
  32. 'al:iphone:url',
  33. 'al:web:should_fallback',
  34. 'al:web:url',
  35. 'al:windows:app_id',
  36. 'al:windows:app_name',
  37. 'al:windows:url',
  38. 'al:windows_phone:app_id',
  39. 'al:windows_phone:app_name',
  40. 'al:windows_phone:url',
  41. 'al:windows_universal:app_id',
  42. 'al:windows_universal:app_name',
  43. 'al:windows_universal:url',
  44. );
  45. /**
  46. * {@inheritdoc}
  47. */
  48. public $test_name_attribute = 'property';
  49. /**
  50. * {@inheritdoc}
  51. */
  52. function setUp(array $modules = array()) {
  53. $modules[] = 'metatag_app_links';
  54. parent::setUp($modules);
  55. }
  56. /**
  57. * {@inheritdoc}
  58. */
  59. public function getTestTagName($tag_name) {
  60. // All of the tags have their underlines replaced with colons.
  61. // Start with the beginning of the string.
  62. $tag_name = str_replace('al_', 'al:', $tag_name);
  63. // The three-ish standard tag names.
  64. $tag_name = str_replace('_app_id', ':app_id', $tag_name);
  65. $tag_name = str_replace('_app_name', ':app_name', $tag_name);
  66. $tag_name = str_replace('_app_store_id', ':app_store_id', $tag_name);
  67. $tag_name = str_replace('_url', ':url', $tag_name);
  68. // One-offs.
  69. $tag_name = str_replace('_class', ':class', $tag_name);
  70. $tag_name = str_replace('_package', ':package', $tag_name);
  71. $tag_name = str_replace('_should_fallback', ':should_fallback', $tag_name);
  72. return $tag_name;
  73. }
  74. }