metatag_panels.test 1.9 KB

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