metatag_views.test 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * @file
  4. * Tests for the Metatag module for the direct Views integration.
  5. */
  6. class MetatagViewsTest extends MetatagTestHelper {
  7. /**
  8. * {@inheritdoc}
  9. */
  10. public static function getInfo() {
  11. return array(
  12. 'name' => 'Metatag:Views tests',
  13. 'description' => 'Test Metatag integration via the Metatag:Views module.',
  14. 'group' => 'Metatag',
  15. );
  16. }
  17. /**
  18. * {@inheritdoc}
  19. */
  20. function setUp(array $modules = array()) {
  21. $modules[] = 'views';
  22. // Enable the hidden submodule to manage some default configs.
  23. $modules[] = 'metatag_views_tests';
  24. parent::setUp($modules);
  25. }
  26. /**
  27. * Test the Metatag:Views translations on an exported page.
  28. */
  29. public function testExportedPage() {
  30. $this->drupalGet('metatag-views-test');
  31. $this->assertResponse(200);
  32. // Test the page title.
  33. $this->assertTitle('Test Views page title');
  34. // Test the description meta tag.
  35. $xpath = $this->xpath("//meta[@name='description']");
  36. $this->assertEqual(count($xpath), 1, 'Exactly one description meta tag found.');
  37. $this->assertEqual($xpath[0]['content'], 'Testing Metatag:Views.');
  38. // Test the keywords meta tag.
  39. $xpath = $this->xpath("//meta[@name='keywords']");
  40. $this->assertEqual(count($xpath), 1, 'Exactly one keywords meta tag found.');
  41. $this->assertEqual($xpath[0]['content'], 'Test, page, keywords');
  42. }
  43. // @todo Test an in-db display.
  44. // @todo Test the master display.
  45. // @todo Test separate displays.
  46. }