metatag_panels.test 1.5 KB

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