metatag_google_plus.tags.test 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. /**
  3. * @file
  4. * Tests that each of the Metatag GooglePlus tags work correctly.
  5. */
  6. /**
  7. * Tests that each of the Metatag GooglePlus tags work correctly.
  8. */
  9. class MetatagGooglePlusTagsTest extends MetatagTagsTestBase {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public static function getInfo() {
  14. return array(
  15. 'name' => 'Metatag tags: GooglePlus',
  16. 'description' => 'Test the Google Plus meta tags.',
  17. 'group' => 'Metatag',
  18. );
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public $tags = array(
  24. // @todo Can't test the output of this tag, it depends upon changes to the
  25. // html.tpl.php file.
  26. // 'itemtype',
  27. 'itemprop:name',
  28. 'itemprop:description',
  29. 'itemprop:image',
  30. 'author',
  31. 'publisher',
  32. );
  33. /**
  34. * {@inheritdoc}
  35. */
  36. function setUp(array $modules = array()) {
  37. $modules[] = 'metatag_google_plus';
  38. parent::setUp($modules);
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function getTestTagName($tag_name) {
  44. // The itemprop meta tags don't have 'itemprop' in their attribute value,
  45. // 'itemprop' is the name of the attribute itself.
  46. return str_replace('itemprop_', '', $tag_name);
  47. }
  48. /**
  49. * {@inheritdoc}
  50. */
  51. public $test_name_attribute = 'itemprop';
  52. /**
  53. * Implements {meta_tag_name}_test_output_xpath() for 'author'.
  54. */
  55. public function author_test_output_xpath() {
  56. return "//link[@rel='author']";
  57. }
  58. /**
  59. * Implements {meta_tag_name}_test_value_attribute() for 'author'.
  60. */
  61. public function author_test_value_attribute() {
  62. return 'href';
  63. }
  64. /**
  65. * Implements {meta_tag_name}_test_key() for 'itemtype'.
  66. */
  67. public function itemtype_test_key() {
  68. return 'metatags[und][itemtype][value]';
  69. }
  70. /**
  71. * Implements {meta_tag_name}_test_value() for 'itemtype'.
  72. */
  73. public function itemtype_test_value() {
  74. return 'Article';
  75. }
  76. /**
  77. * Implements {meta_tag_name}_test_value() for 'itemprop_image'.
  78. */
  79. public function itemprop_image_test_value() {
  80. return $this->randomImageUrl();
  81. }
  82. /**
  83. * Implements {meta_tag_name}_test_field_xpath() for 'itemtype'.
  84. */
  85. public function itemtype_test_field_xpath() {
  86. return "//select[@name='metatags[und][itemtype][value]']";
  87. }
  88. /**
  89. * Implements {meta_tag_name}_test_output_xpath() for 'itemtype'.
  90. */
  91. public function itemtype_test_output_xpath() {
  92. return "//html[@rel='itemtype']";
  93. }
  94. /**
  95. * Implements {meta_tag_name}_test_output_xpath() for 'publisher'.
  96. */
  97. public function publisher_test_output_xpath() {
  98. return "//link[@rel='publisher']";
  99. }
  100. /**
  101. * Implements {meta_tag_name}_test_output_xpath() for 'publisher'.
  102. */
  103. public function publisher_test_value_attribute() {
  104. return 'href';
  105. }
  106. }