metatag_views.test 1.5 KB

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